Here you can find the source of getCurrentTimeStr()
public static String getCurrentTimeStr()
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss"; public static String getCurrentTimeStr() { SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT); Date d = new Date(System.currentTimeMillis()); return dateFormat.format(d); }/* w w w .j a v a 2s .c om*/ }