Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to convert MS SQL DateTime into Java Date?

 
Ravi Sathish
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am not able to figure how to conevert a MS SQL 2000 DateTime to Java format viz. date, time or Time stamp?
I am trying to retrive from database using resultset
I tired string, object etc
any help will be appreciated
Thanks
Ravi
 
Marie Mazerolle
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm sure there's a better solution than this, but in your query, you could select YEAR(theDate), MONTH(theDate) and DAY(theDate). Then, construct a java date from these values.
 
shankar vembu
Ranch Hand
Posts: 309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ResultSet.getDate(index) should return a java.sql.Date. Dint this work for you?
reg.
[ December 02, 2003: Message edited by: shankar vembu ]
 
Ravi Sathish
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Marie
That one works cool. Is there a way to extract the time similarly?
Ravi
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic