Solved

How to convert Java.util.Date to Calendar?

Posted on 2006-11-15
2
2,449 Views
Last Modified: 2012-06-22
Dear Experts,

I'm trying to convert a Java.util.Date to a Calendar.  Apparently, the ...Date is being deprecated in favor of Calendar.  I don't actually have the Date per se.  I have the "milliseconds since 12/1/1970" long value, which apparently forms the basis of Date.  WITHOUT USING DEPRECATED DATE METHODS, is there a way I can convert the long value directly into a Calendar?

Thanks,
BrianMc1958
0
Comment
Question by:BrianMc1958
2 Comments
 
LVL 23

Accepted Solution

by:
Ajay-Singh earned 500 total points
ID: 17949521
use this:


Calender cal = Calendar.getInstance();
cal.setTimeInMillis(...);
0
 

Author Comment

by:BrianMc1958
ID: 17949536
All right!
--BrianMc1958
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
This video teaches viewers about errors in exception handling.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now