Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Date Formatting

 
jaya sudha
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic