List of usage examples for org.joda.time.convert ConverterManager getInstance
public static ConverterManager getInstance()
From source file:com.helger.datetime.config.PDTTypeConverterRegistrar.java
License:Apache License
private static void _registerJodaConverter() { // Register generic Number converters, that work with Long, Integer, // BigInteger etc. ConverterManager.getInstance().addInstantConverter(PDTJodaNumberConverter.INSTANCE); ConverterManager.getInstance().addPartialConverter(PDTJodaNumberConverter.INSTANCE); ConverterManager.getInstance().addDurationConverter(PDTJodaNumberConverter.INSTANCE); }
From source file:org.jsr166e.BaseDateTime.java
License:Apache License
/** * Constructs an instance from an Object that represents a datetime, * forcing the time zone to that specified. * <p/>/*from ww w .j av a 2 s . c o m*/ * If the object contains no chronology, <code>ISOChronology</code> is used. * If the specified time zone is null, the default zone is used. * <p/> * The recognised object types are defined in * {@link org.joda.time.convert.ConverterManager ConverterManager} and * include ReadableInstant, String, Calendar and Date. * * @param instant the datetime object * @param zone the time zone * @throws IllegalArgumentException if the instant is invalid */ public BaseDateTime(Object instant, DateTimeZone zone) { super(); InstantConverter converter = ConverterManager.getInstance().getInstantConverter(instant); Chronology chrono = checkChronology(converter.getChronology(instant, zone)); iChronology = chrono; iMillis = checkInstant(converter.getInstantMillis(instant, chrono), chrono); }
From source file:org.jsr166e.BaseDateTime.java
License:Apache License
/** * Constructs an instance from an Object that represents a datetime, * using the specified chronology./*from w ww.ja v a 2 s.c o m*/ * <p/> * If the chronology is null, ISO in the default time zone is used. * <p/> * The recognised object types are defined in * {@link org.joda.time.convert.ConverterManager ConverterManager} and * include ReadableInstant, String, Calendar and Date. * * @param instant the datetime object * @param chronology the chronology * @throws IllegalArgumentException if the instant is invalid */ public BaseDateTime(Object instant, Chronology chronology) { super(); InstantConverter converter = ConverterManager.getInstance().getInstantConverter(instant); iChronology = checkChronology(converter.getChronology(instant, chronology)); iMillis = checkInstant(converter.getInstantMillis(instant, chronology), iChronology); }