This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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


JavaRanch » Java Forums » Java » Beginning Java
Bookmark " Fetching Time from Resultset" Watch " Fetching Time from Resultset" New topic
Author

Fetching Time from Resultset

Srikrishna DhumalRao
Greenhorn

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


srikrishna
Arnaud Burlet
Ranch Hand

Joined: Oct 08, 2004
Posts: 31
Hi,

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
-->

Arnaud
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Fetching Time from Resultset
 
It's not a secret anymore!