Here you can find the source of getDurationFromCalendar( final XMLGregorianCalendar cal)
getDurationFromCalendar.
Parameter | Description |
---|---|
cal | a javax.xml.datatype.XMLGregorianCalendar object. |
public static Duration getDurationFromCalendar( final XMLGregorianCalendar cal)
//package com.java2s; import javax.xml.datatype.DatatypeConfigurationException; import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.Duration; import javax.xml.datatype.XMLGregorianCalendar; public class Main { /**/* w ww . ja v a2 s . co m*/ * <p>getDurationFromCalendar.</p> * * @param cal a {@link javax.xml.datatype.XMLGregorianCalendar} object. * @return a {@link javax.xml.datatype.Duration} object. */ public static Duration getDurationFromCalendar( final XMLGregorianCalendar cal) { Duration dur; try { dur = DatatypeFactory.newInstance().newDurationDayTime( cal.getTimezone() * 60000); } catch (final DatatypeConfigurationException e) { return null; } return dur; } }