Java XML Date Create toDateTime()

Here you can find the source of toDateTime()

Description

to Date Time

License

Apache License

Declaration

public static Function<XMLGregorianCalendar, DateTime> toDateTime() 

Method Source Code


//package com.java2s;
// Licensed under the Apache License, Version 2.0 (the "License");

import com.google.common.base.Function;
import org.joda.time.DateTime;

import javax.annotation.Nullable;

import javax.xml.datatype.XMLGregorianCalendar;

public class Main {
    private static final Function<XMLGregorianCalendar, DateTime> xmlToJoda = new Function<XMLGregorianCalendar, DateTime>() {
        @Nullable// w ww .  j a v a  2 s . co m
        @Override
        public DateTime apply(@Nullable XMLGregorianCalendar input) {
            return input == null ? null : new DateTime(input.toGregorianCalendar().getTime());
        }
    };

    public static Function<XMLGregorianCalendar, DateTime> toDateTime() {
        return xmlToJoda;
    }

    public static DateTime toDateTime(@Nullable XMLGregorianCalendar time) {
        return xmlToJoda.apply(time);
    }
}

Related

  1. toDate(XMLGregorianCalendar cal)
  2. toDate(XMLGregorianCalendar date)
  3. toDate(XMLGregorianCalendar dateTime)
  4. toDate(XMLGregorianCalendar xmlCalendar)
  5. toDate(XMLGregorianCalendar xmlGregorianCalendar)
  6. toDateTime(Date date)
  7. toXMLCalendar(Date date)
  8. toXmlDate(Date date)
  9. toXMLDate(Date date)