How about using trying out the following code:
public static void main(String[] args) {
sqlTime = new Time(hour,min,sec);
utilDate = new Date(sqlTime.getTime());
String formattedDate = getDateString(sqlTime, "h:mm a");
System.out.println("Time = "+formattedDate);
}
public static String getDateString(java.util.Date date, String format) {
java.text.SimpleDateFormat dt = new java.text.SimpleDateFormat(format);
String formattedDate = dt.format(date);
return formattedDate;
}
This worked for me.
:)