Java Date Now getCurrentTimeForLog()

Here you can find the source of getCurrentTimeForLog()

Description

Get current time string in format mm-dd-yy 5:31:31 PM

License

Open Source License

Declaration

public static String getCurrentTimeForLog() 

Method Source Code

//package com.java2s;

import java.text.DateFormat;
import java.util.Date;

import java.util.Locale;

public class Main {
    /**//  w  w w .jav  a2 s  .c o  m
     * Get current time string in format mm-dd-yy 5:31:31 PM
     *
     * @return
     */
    public static String getCurrentTimeForLog() {
        return DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM, Locale.US).format(new Date())
                .replaceAll("/", "-");
    }
}

Related

  1. getCurrentTime2MysqlDateTime()
  2. getCurrentTimeAndDate()
  3. getCurrentTimeAsNumber()
  4. getCurrentTimeAsString()
  5. getCurrentTimeForFileName()
  6. getCurrentTimeForName()
  7. getCurrentTimeForUseInAFileName()
  8. getCurrentTimeInMySqlTime()
  9. getCurrentTimeInMySqlTime()