Java XML Date Create dateToXmlGregorianCalendar(Date d)

Here you can find the source of dateToXmlGregorianCalendar(Date d)

Description

date To Xml Gregorian Calendar

License

Open Source License

Declaration

public static XMLGregorianCalendar dateToXmlGregorianCalendar(Date d) 

Method Source Code

//package com.java2s;
/*/*from  w w w  . ja  v a 2 s  .c o  m*/
 * GovPay - Porta di Accesso al Nodo dei Pagamenti SPC 
 * http://www.gov4j.it/govpay
 * 
 * Copyright (c) 2014-2015 Link.it srl (http://www.link.it).
 * Copyright (c) 2014-2015 TAS S.p.A. (http://www.tasgroup.it).
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

import java.util.Date;
import java.util.GregorianCalendar;

import javax.xml.datatype.DatatypeFactory;

import javax.xml.datatype.XMLGregorianCalendar;

public class Main {
    private static DatatypeFactory datatypeFactory;

    public static XMLGregorianCalendar dateToXmlGregorianCalendar(Date d) {

        if (d == null) {
            return null;
        }

        GregorianCalendar gregory = new GregorianCalendar();
        gregory.setTime(d);
        XMLGregorianCalendar returnValue;
        returnValue = datatypeFactory.newXMLGregorianCalendar(gregory);
        return returnValue;

    }
}

Related

  1. DateToXmlCalendar(Date date)
  2. dateToXmlDate(Date date)
  3. dateToXMLGC(Date fecha)
  4. dateToXmlGregorian(Date timestamp)
  5. dateToXmlGregorianCalendar(Calendar date)
  6. dateToXMLGregorianCalendar(Date date)
  7. dateToXMLGregorianCalendar(Date date)
  8. getXMLCalendar(String xsdDateTimeStr)
  9. getXMLCurrentTime()