Here you can find the source of longToGregorian(long date)
Parameter | Description |
---|---|
date | a parameter |
public static XMLGregorianCalendar longToGregorian(long date)
//package com.java2s; //License from project: Open Source License import java.util.GregorianCalendar; import javax.xml.datatype.DatatypeConfigurationException; import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.XMLGregorianCalendar; public class Main { /**//www . ja v a 2s. c o m * Transform a date in a long to a GregorianCalendar * * @param date * @return */ public static XMLGregorianCalendar longToGregorian(long date) { DatatypeFactory dataTypeFactory; try { dataTypeFactory = DatatypeFactory.newInstance(); } catch (DatatypeConfigurationException e) { throw new RuntimeException(e); } GregorianCalendar gc = new GregorianCalendar(); gc.setTimeInMillis(date); return dataTypeFactory.newXMLGregorianCalendar(gc); } }