Example usage for org.joda.time.convert InstantConverter getInstantMillis

List of usage examples for org.joda.time.convert InstantConverter getInstantMillis

Introduction

In this page you can find the example usage for org.joda.time.convert InstantConverter getInstantMillis.

Prototype

long getInstantMillis(Object object, Chronology chrono);

Source Link

Document

Extracts the millis from an object of this converter's type.

Usage

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);
}