Here you can find the source of getTime()
public static String getTime()
//package com.java2s; public class Main { public static String getTime() { java.util.Date dt = new java.util.Date(); java.sql.Timestamp ts = new java.sql.Timestamp(dt.getTime()); String time = ts.toString(); return time.substring(0, 19); }//from www .ja va2s . c o m }