This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes Retreiving the current data from the database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Retreiving the current data from the database" Watch "Retreiving the current data from the database" New topic
Author

Retreiving the current data from the database

Hanna Habashy
Ranch Hand

Joined: Aug 20, 2003
Posts: 532
I am trying to get the date from the database. I can read it fin, but the hour, minutes, and sec values are missing.
Here is a segment of my code:


The value in sqlDate returned is 2009-09-03, however the value returned from the database console is 2009-09-03 12:16:13.747

How can I get the full date?
I tried use Date.getTime(), cast it to java.util.Date, not it not working.

Your help is appreciated.


SCJD 1.4<br />SCJP 1.4<br />-----------------------------------<br />"With regard to excellence, it is not enough to know, but we must try to have and use it.<br />" Aristotle
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

Have you tried with rs.getTimestamp(1) ??


Regards, Rene Larsen
Dropbox Invite
Hanna Habashy
Ranch Hand

Joined: Aug 20, 2003
Posts: 532
Rene Larsen wrote:Have you tried with rs.getTimestamp(1) ??



Thank you very much, this solved it.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Retreiving the current data from the database
 
jQuery in Action, 3rd edition