Here you can find the source of getTime()
public static String getTime()
//package com.java2s; import java.sql.Timestamp; import java.util.Calendar; public class Main { public static String getTime() { Timestamp time = new Timestamp(Calendar.getInstance().getTime().getTime()); return time.toString(); }/*from ww w . j a v a 2s . co m*/ }