aspose file tools*
The moose likes Beginning Java and the fly likes How do I convert a Timestamp to a Calendar? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How do I convert a Timestamp to a Calendar?" Watch "How do I convert a Timestamp to a Calendar?" New topic
Author

How do I convert a Timestamp to a Calendar?

keith tyson
Greenhorn

Joined: Sep 28, 2001
Posts: 7
I have a method that returns a Timestamp and I need to pass this to a method that is expecting a Calendar object.
ie.
deliveryDetails.getWindowStart() // returns a Timestamp
and I need to pass another method this value as a Calendar.
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Keith,
Since Timestamp is a subclass of Date, the following should work:
GregorianCalendar gc = new GregorianCalendar();
gc.setTime( deliveryDetails.getWindowStart() );
newMethod( gc );
Regards,
Manfred.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do I convert a Timestamp to a Calendar?
 
Similar Threads
How do i convert a Date object into a Timestamp object ?
How do i convert a Date object into a TimeStamp object
How do I convert a Timestamp to a Calendar?
How do i convert a Date object into a Timestamp object ?
TimeStamp.toString() does not work as expected