Here you can find the source of getTime()
public static String getTime()
//package com.java2s; import java.sql.Time; import java.util.Calendar; public class Main { public static String getTime() { Calendar c = Calendar.getInstance(); int theHour = c.get(Calendar.HOUR_OF_DAY); int theMinute = c.get(Calendar.MINUTE); int theSecond = c.get(Calendar.SECOND); return (new Time(theHour, theMinute, theSecond)).toString(); }/* w w w . j a v a2s . c o m*/ }