Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: LGPL 

import java.util.GregorianCalendar;
import java.util.TimeZone;
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;

public class Main {
    public static GregorianCalendar fromXSDateTime(String dateTime) throws DatatypeConfigurationException {
        GregorianCalendar cal = null;

        if (dateTime != null && dateTime.length() != 0) {
            cal = DatatypeFactory.newInstance().newXMLGregorianCalendar(dateTime).toGregorianCalendar();
            cal.setTimeZone(TimeZone.getTimeZone("UTC"));
        }

        return cal;
    }
}