@@ -0,0 +1,2215 @@
+/**%0A * Copyright 2011 Microsoft Corporation%0A * %0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A * http://www.apache.org/licenses/LICENSE-2.0%0A * %0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage com.microsoft.windowsazure.services.core.utils;%0A%0Aimport java.util.Date;%0Aimport java.util.GregorianCalendar;%0A%0Aimport javax.xml.datatype.DatatypeConfigurationException;%0Aimport javax.xml.datatype.DatatypeFactory;%0Aimport javax.xml.datatype.XMLGregorianCalendar;%0A%0A/**%0A * The Class DateConverter.%0A */%0Apublic class DateConverter %7B%0A%0A    /** The datatype factory. */%0A    private static DatatypeFactory datatypeFactory = null;%0A%0A    static %7B%0A        try %7B%0A            datatypeFactory = DatatypeFactory.newInstance();%0A        %7D%0A        catch (DatatypeConfigurationException e) %7B%0A            throw new IllegalStateException(%22Cannot create a new DatatypeFactory instance.%22, e);%0A        %7D%0A    %7D%0A%0A    /**%0A     * XML gregorian calendar to date.%0A     * %0A     * @param xmlGregorianCalendar%0A     *            the xml gregorian calendar%0A     * @return the date%0A     */%0A    public static Date XMLGregorianCalendarToDate(XMLGregorianCalendar xmlGregorianCalendar) %7B%0A        if (xmlGregorianCalendar == null) %7B%0A            return null;%0A        %7D%0A%0A        return xmlGregorianCalendar.toGregorianCalendar().getTime();%0A    %7D%0A%0A    /**%0A     * Date to xml gregorian calendar.%0A     * %0A     * @param date%0A     *            the date%0A     * @return the xML gregorian calendar%0A     */%0A    public static XMLGregorianCalendar DateToXMLGregorianCalendar(Date date) %7B%0A        if (date == null) %7B%0A            return null;%0A        %7D%0A%0A        GregorianCalendar gregorianCalendar = new GregorianCalendar();%0A        gregorianCalendar.setTimeInMillis(date.getTime());%0A        return datatypeFactory.newXMLGregorianCalendar(gregorianCalendar);%0A    %7D%0A%7D%0A

Add DateConverter to transform XMLGregorianCalendar back and forth.