Here you can find the source of getNowDateTime()
public static Date getNowDateTime()
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static Date getNowDateTime() { return Calendar.getInstance().getTime(); }/* w w w . j a v a 2 s. c o m*/ public static String getTime(Date dt, String format) { SimpleDateFormat st = new SimpleDateFormat(format); return st.format(dt); } }