Here you can find the source of getCurrentTime()
public static String getCurrentTime()
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String getCurrentTime() { return getFormatDateTime(new Date(), "yyyy-MM-dd HH:mm:ss"); }//from w ww . j a va 2s . c om public static String getFormatDateTime(Date date, String format) { SimpleDateFormat sdf = new SimpleDateFormat(format); return sdf.format(date); } }