Here you can find the source of getXMLGregorianCalendar(TimeZone timeZone, Locale locale)
public static XMLGregorianCalendar getXMLGregorianCalendar(TimeZone timeZone, Locale locale) throws DatatypeConfigurationException
//package com.java2s; /*!/*from w w w.j av a 2 s. c o m*/ * mifmi-commons4j * https://github.com/mifmi/mifmi-commons4j * * Copyright (c) 2015 mifmi.org and other contributors * Released under the MIT license * https://opensource.org/licenses/MIT */ import java.util.GregorianCalendar; import java.util.Locale; import java.util.TimeZone; import javax.xml.datatype.DatatypeConfigurationException; import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.XMLGregorianCalendar; public class Main { public static XMLGregorianCalendar getXMLGregorianCalendar(TimeZone timeZone, Locale locale) throws DatatypeConfigurationException { return DatatypeFactory.newInstance().newXMLGregorianCalendar(getGregorianCalendar(timeZone, locale)); } public static GregorianCalendar getGregorianCalendar(TimeZone timeZone, Locale locale) { GregorianCalendar gcal; if (timeZone == null) { if (locale == null) { gcal = new GregorianCalendar(); } else { gcal = new GregorianCalendar(locale); } } else { if (locale == null) { gcal = new GregorianCalendar(timeZone); } else { gcal = new GregorianCalendar(timeZone, locale); } } return gcal; } }