This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Java in General and the fly likes Date to Calendar object 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 » Java in General
Bookmark "Date to Calendar object" Watch "Date to Calendar object" New topic
Author

Date to Calendar object

Arun Boraiah
Ranch Hand

Joined: Nov 28, 2001
Posts: 233
hi,
I have a java.util.Date object storing some date.
Now i want to convert to java.util.Calendar object because most of the methods are deprecated in Date class and suggested to use Calendar class instead.
Thanks in advance.
Arun


Sharing is learning
Marcel de Jong
Ranch Hand

Joined: May 27, 2002
Posts: 54
Arun,
to convert a java.util.Date to a Calendar, just get an instance of Calendar and then set the time with the method setTime(java.util.Date)
Regards,
Marcel
 
 
subject: Date to Calendar object
 
Similar Threads
Passing parameters
Static variable Question
Need to get a Day from Date
TimeStamp.toString() does not work as expected
add 10 days to currentDate in java.util.Date or cast to Calendar?