This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Convert a Timestamp to Calander Object

 
Rahim Nathwani
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Heyy All

I have a java.sql.Timestamp and I need to convert it to a
java.util.Calendar object.

Any ideas?

Thanks
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you look at the API, there is a method in TimeStamp that will convert it to a long, and a method in Date which will convert a long to a Date. Then there is a method in Calendar that will let you use the Date object.
 
Paul Clapham
Sheriff
Pie
Posts: 20945
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
However since a Timestamp already is a Date, you can skip the first part.
 
Rahim Nathwani
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks

Worked!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic