17

Is there any existing way to get a Calendar populated with time at epoch using Calendar API's other than explicitly setting them at epoch? All I was able to do was to get the current time.

1 Answer 1

41

There is no pre defined constructor or factory method to do this, but it is fairly simple:

Calendar c = Calendar.getInstance();
c.setTimeInMillis(0);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.