• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Fetching Time from Resultset

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
reply
    Bookmark Topic Watch Topic
  • New Topic