Java XML Transform Usage longToGregorian(long date)

Here you can find the source of longToGregorian(long date)

Description

Transform a date in a long to a GregorianCalendar

License

Open Source License

Parameter

Parameter Description
date a parameter

Declaration

public static XMLGregorianCalendar longToGregorian(long date) 

Method Source Code

//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);
    }
}

Related

  1. getStreamSources(File[] stylesheets)
  2. getTemplatesByName(File xslF)
  3. getWSAAddress(W3CEndpointReference ref)
  4. getXMLCalendar(Date date)
  5. getXmlEventWriter(Result r)
  6. map2Xml(Map map)
  7. newSchema(File xmlSchema)
  8. newSchema(Source[] schemas)
  9. paramsEqual(AlgorithmParameterSpec spec1, AlgorithmParameterSpec spec2)