1

如何在 java 中将 UNIX 时间戳转换为 XMLGregorianCalendar 值?

时间戳:1379487623

4

1 回答 1

3
long time = 1379487623;
Date date = new Date((long)time*1000);
GregorianCalendar c = new GregorianCalendar();
c.setTime(date);
XMLGregorianCalendar date2 = DatatypeFactory.newInstance().newXMLGregorianCalendar(c);
于 2013-09-18T07:12:04.723 回答