Getting Hrs and Minutes of java.sql.Date

I've the following statement to get the datejava.sql.Time t = rs.getTime("time");I want to display the Hrs and Minutes separately of the component t. How do I do that?
[189 byte] By [harinibiligiria] at [2007-11-26 19:55:57]
# 1

Didn't really get what you meant by "separatly". You should take a look at the DateFormat in the Java API

for example:

SimpleDateFormat formatter = new SimpleDateFormat("HH:mm");

out.print(formatter.format(t));

will print 23:00 when the pub closes ;)

alban.maillerea at 2007-7-9 22:49:30 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2
I mean I want to get Hours and Minutes as separate components for display purpose.suppose if it is 19:30 , I wud like to get 19 and 30 separately. How do I do that
harinibiligiria at 2007-7-9 22:49:30 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3

You need to convert your sql time to a Calendar object.

java.sql.Time time = rs.getTime("time_field");

Calendar cal = Calendar.getInstance();

// set the calendar to have your time

cal.setTimeInMillis(time.getTime());

int hour = cal.get(Calendar.HOUR);

int minutes = cal.get(Calendar.MINUTE));

ricardo_joa at 2007-7-9 22:49:30 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...