Solved

How to convert Java.util.Date to Calendar?

Posted on 2006-11-15
2
2,448 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This video teaches viewers about errors in exception handling.

743 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

11 Experts available now in Live!

Get 1:1 Help Now