List of usage examples for org.joda.time.convert InstantConverter getInstantMillis
long getInstantMillis(Object object, Chronology chrono);
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/>// ww w .j a v a2s . co 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 w w . j a 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); }