Here you can find the source of getTime()
public static String getTime()
//package com.java2s; import java.util.Calendar; import java.sql.Time; 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); //long time = c.get(Calendar.) return (new Time(theHour, theMinute, theSecond)).toString(); }/*w w w .ja v a2 s .c o m*/ }