Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2459
  • Last Modified:

How to convert Java.util.Date to Calendar?

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
BrianMc1958
Asked:
BrianMc1958
1 Solution
 
Ajay-SinghCommented:
use this:


Calender cal = Calendar.getInstance();
cal.setTimeInMillis(...);
0
 
BrianMc1958Author Commented:
All right!
--BrianMc1958
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now