Java XML Date Create xmlGregorianCalendarToDate(XMLGregorianCalendar calendar)

Here you can find the source of xmlGregorianCalendarToDate(XMLGregorianCalendar calendar)

Description

Converts XMLGregorianCalendar to java.util.Date in Java

License

Apache License

Parameter

Parameter Description
calendar the calendar

Return

Date

Declaration

public static Date xmlGregorianCalendarToDate(XMLGregorianCalendar calendar) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright 2018 Johns Hopkins University
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.//from   ww w  .jav a2  s.  c  om
 *
 * This software was produced as part of the RMap Project (http://rmap-project.info),
 * The RMap Project was funded by the Alfred P. Sloan Foundation and is a 
 * collaboration between Data Conservancy, Portico, and IEEE.
 *******************************************************************************/

import java.util.Date;
import javax.xml.datatype.XMLGregorianCalendar;

public class Main {
    /**
     * Converts XMLGregorianCalendar to java.util.Date in Java
     *
     * @param calendar the calendar
     * @return Date
     */
    public static Date xmlGregorianCalendarToDate(XMLGregorianCalendar calendar) {
        if (calendar == null) {
            return null;
        }
        return calendar.toGregorianCalendar().getTime();
    }
}

Related

  1. xmlDateToLong(String s)
  2. xmlGCtoMillis(XMLGregorianCalendar gc)
  3. xmlGregorian2Gregorian(XMLGregorianCalendar xmlGC)
  4. xmlGregorianCalendar()
  5. xmlGregorianCalendarToDate(XMLGregorianCalendar cal)
  6. XMLGregorianCalendarToDate(XMLGregorianCalendar gc)
  7. xmlGregorianCalendarToTimestamp(XMLGregorianCalendar xgc)
  8. xmlGregorianToString(XMLGregorianCalendar timestamp)
  9. xmlToDate(XMLGregorianCalendar calendar, DateFormat format)