permaculture playing cards*
The moose likes Beginning Java and the fly likes  Fetching Time from Resultset Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark " Fetching Time from Resultset" Watch " Fetching Time from Resultset" New topic

Fetching Time from Resultset

Srikrishna DhumalRao

Joined: Oct 05, 2004
Posts: 17
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.

Arnaud Burlet
Ranch Hand

Joined: Oct 08, 2004
Posts: 31

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

I agree. Here's the link:
subject: Fetching Time from Resultset
Similar Threads
score 61% or 71% ???
Passed with 86%
Performance not improving after using Multithreading
completed part 2
How to do Http Session time out by using the time given instead of duration