Here you can find the source of nowAsTime()
public static Time nowAsTime()
//package com.java2s; import java.sql.Time; import java.util.Calendar; public class Main { public static Time nowAsTime() { Calendar objCurrentCalendar = Calendar.getInstance(); StringBuffer sbTimeString = new StringBuffer(); int iHourOfDay = objCurrentCalendar.get(Calendar.HOUR_OF_DAY); int iMinute = objCurrentCalendar.get(Calendar.MINUTE); int iSecond = objCurrentCalendar.get(Calendar.SECOND); sbTimeString.append(iHourOfDay); sbTimeString.append(":"); sbTimeString.append(iMinute);/* ww w. j a v a 2s. co m*/ sbTimeString.append(":"); sbTimeString.append(iSecond); return java.sql.Time.valueOf(sbTimeString.toString()); } }