This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes Date Formatting 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 » Databases » JDBC
Bookmark "Date Formatting" Watch "Date Formatting" New topic
Author

Date Formatting

jaya sudha
Greenhorn

Joined: Jun 18, 2004
Posts: 20
Hi Every one........

In my Database table i have a date column when im trying to retrieve a particular date using JDBC im not getting the right date format..

in Table : 7/7/2004

when im retrieving using JDBC using

String strDate = rs.getString("my_date");

this is displayed..January 1, 1970, 00:00:00 GMT
But i want to disply it as 01/01/1970

THanks


Sudha
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

First - recover the date from your ResultSet as a Date, not a String. Second - look at java.text.SimpleDateFormat. That should make it clear.
[ July 08, 2004: Message edited by: Paul Sturrock ]

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Date Formatting
 
Similar Threads
Calendar() / Date() bug ???
Struts + Display tag.
Specify Date as 0000-00-00
Parsing Date/Time String - Urgent
checking validity of date with ddMM format