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 PARSE_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss"; public static String getCurrentTimeStr() { SimpleDateFormat dateFormat = new SimpleDateFormat( PARSE_DATE_FORMAT);//from w w w . java2s . co m Date d = new Date(System.currentTimeMillis()); return dateFormat.format(d); } }