Here you can find the source of getCurrentTimeForLog()
public static String getCurrentTimeForLog()
//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("/", "-"); } }