-3

How to convert Large Integer 130552992000000000 into date format?

This is today’s date and timestamp. I tried with

Date d = new Date(130552992000000000L * 1000);
System.out.println("Date : " +d);

But its showing Date : Wed Dec 29 00:28:58 IST 45183249 date which is incorrect and not showing year too.

Thanks in advance.

4

1 回答 1

2

您可以使用Calendar#setTimeInMillis(long timemillis)方法并Date通过调用Calendar#getTime()方法来检索。

Long l = //some value
Calendar c = Calendar.getInstance();
c.setTimeInMillis(l);
Date date = c.getTime();
于 2013-09-16T12:17:29.983 回答