Here you can find the source of getCurrentDateTime()
public static String getCurrentDateTime()
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String getCurrentDateTime() { return getFormatDateTime(new Date(), "yyyy-MM-dd HH:mm:ss"); }/* w ww . ja v a2 s . c om*/ public static String getFormatDateTime(Date date, String format) { SimpleDateFormat sdf = new SimpleDateFormat(format); return sdf.format(date); } }