开发者

How to create a java.util.Calendar instance at epoch time?

开发者 https://www.devze.com 2023-01-20 19:34 出处:网络
Is there any existing way to get a Calendar populated with time at epoch using Calendar API\'s other than expli开发者_StackOverflow社区citly setting them at epoch? All I was able to do was to get the

Is there any existing way to get a Calendar populated with time at epoch using Calendar API's other than expli开发者_StackOverflow社区citly setting them at epoch? All I was able to do was to get the current time.


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

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

精彩评论

暂无评论...
验证码 换一张
取 消