A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Fetching Time from Resultset
Joined: Oct 05, 2004
Oct 14, 2004 01:32:00
I have to get the time in minutes from a date column in database.
I am using rs.getTime() which returns a java.sql.Time object .my problem is to convert it into minutes - is there any built in method for this job.
Joined: Oct 08, 2004
Oct 14, 2004 01:57:00
it depends on what you need, but first note that your java.sql.Time extends Date, so you inherit methods from Date class...
- you need to know how much minutes are in your java.sql.Time object.
--> rs.getTime().getTime() will give you milliseconds since January 1, 1970, 00:00:00 GMT, just divide...
- you need to know how much minutes within the hour, use a Calendar
Calendar c = new Calendar(); c.setTime(rs.getTime()); c.get(Calendar.MINUTE);
I agree. Here's the link:
subject: Fetching Time from Resultset
How to do Http Session time out by using the time given instead of duration
completed part 2
Passed with 86%
score 61% or 71% ???
Performance not improving after using Multithreading
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014