Java Code Examples for org.joda.time.Chronology#withUTC()
The following examples show how to use
org.joda.time.Chronology#withUTC() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ZonedChronology.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Create a ZonedChronology for any chronology, overriding any time zone it * may already have. * * @param base base chronology to wrap * @param zone the time zone * @throws IllegalArgumentException if chronology or time zone is null */ public static ZonedChronology getInstance(Chronology base, DateTimeZone zone) { if (base == null) { throw new IllegalArgumentException("Must supply a chronology"); } base = base.withUTC(); if (base == null) { throw new IllegalArgumentException("UTC chronology must not be null"); } if (zone == null) { throw new IllegalArgumentException("DateTimeZone must not be null"); } return new ZonedChronology(base, zone); }
Example 2
Source File: Nopol2017_0087_t.java From coming with MIT License | 5 votes |
/** * Constructs a bucket, with the option of specifying the pivot year for * two-digit year parsing. * * @param instantLocal the initial millis from 1970-01-01T00:00:00, local time * @param chrono the chronology to use * @param locale the locale to use * @param pivotYear the pivot year to use when parsing two-digit years * @since 2.0 */ public DateTimeParserBucket(long instantLocal, Chronology chrono, Locale locale, Integer pivotYear, int defaultYear) { super(); chrono = DateTimeUtils.getChronology(chrono); iMillis = instantLocal; iZone = chrono.getZone(); iChrono = chrono.withUTC(); iLocale = (locale == null ? Locale.getDefault() : locale); iPivotYear = pivotYear; iDefaultYear = defaultYear; }
Example 3
Source File: Nopol2017_0087_s.java From coming with MIT License | 5 votes |
/** * Constructs a bucket, with the option of specifying the pivot year for * two-digit year parsing. * * @param instantLocal the initial millis from 1970-01-01T00:00:00, local time * @param chrono the chronology to use * @param locale the locale to use * @param pivotYear the pivot year to use when parsing two-digit years * @since 2.0 */ public DateTimeParserBucket(long instantLocal, Chronology chrono, Locale locale, Integer pivotYear, int defaultYear) { super(); chrono = DateTimeUtils.getChronology(chrono); iMillis = instantLocal; iZone = chrono.getZone(); iChrono = chrono.withUTC(); iLocale = (locale == null ? Locale.getDefault() : locale); iPivotYear = pivotYear; iDefaultYear = defaultYear; }
Example 4
Source File: DateTimeParserBucket.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Constructs a bucket, with the option of specifying the pivot year for * two-digit year parsing. * * @param instantLocal the initial millis from 1970-01-01T00:00:00, local time * @param chrono the chronology to use * @param locale the locale to use * @param pivotYear the pivot year to use when parsing two-digit years * @since 2.0 */ public DateTimeParserBucket(long instantLocal, Chronology chrono, Locale locale, Integer pivotYear, int defaultYear) { super(); chrono = DateTimeUtils.getChronology(chrono); iMillis = instantLocal; iZone = chrono.getZone(); iChrono = chrono.withUTC(); iLocale = (locale == null ? Locale.getDefault() : locale); iPivotYear = pivotYear; iDefaultYear = defaultYear; }
Example 5
Source File: Time_24_DateTimeParserBucket_t.java From coming with MIT License | 5 votes |
/** * Constructs a bucket, with the option of specifying the pivot year for * two-digit year parsing. * * @param instantLocal the initial millis from 1970-01-01T00:00:00, local time * @param chrono the chronology to use * @param locale the locale to use * @param pivotYear the pivot year to use when parsing two-digit years * @since 2.0 */ public DateTimeParserBucket(long instantLocal, Chronology chrono, Locale locale, Integer pivotYear, int defaultYear) { super(); chrono = DateTimeUtils.getChronology(chrono); iMillis = instantLocal; iChrono = chrono.withUTC(); iLocale = (locale == null ? Locale.getDefault() : locale); setZone(chrono.getZone()); iPivotYear = pivotYear; iDefaultYear = defaultYear; }
Example 6
Source File: Time_26_ZonedChronology_t.java From coming with MIT License | 5 votes |
/** * Create a ZonedChronology for any chronology, overriding any time zone it * may already have. * * @param base base chronology to wrap * @param zone the time zone * @throws IllegalArgumentException if chronology or time zone is null */ public static ZonedChronology getInstance(Chronology base, DateTimeZone zone) { if (base == null) { throw new IllegalArgumentException("Must supply a chronology"); } base = base.withUTC(); if (base == null) { throw new IllegalArgumentException("UTC chronology must not be null"); } if (zone == null) { throw new IllegalArgumentException("DateTimeZone must not be null"); } return new ZonedChronology(base, zone); }
Example 7
Source File: Time_26_ZonedChronology_s.java From coming with MIT License | 5 votes |
/** * Create a ZonedChronology for any chronology, overriding any time zone it * may already have. * * @param base base chronology to wrap * @param zone the time zone * @throws IllegalArgumentException if chronology or time zone is null */ public static ZonedChronology getInstance(Chronology base, DateTimeZone zone) { if (base == null) { throw new IllegalArgumentException("Must supply a chronology"); } base = base.withUTC(); if (base == null) { throw new IllegalArgumentException("UTC chronology must not be null"); } if (zone == null) { throw new IllegalArgumentException("DateTimeZone must not be null"); } return new ZonedChronology(base, zone); }
Example 8
Source File: Nopol2017_0091_t.java From coming with MIT License | 5 votes |
/** * Constructs a bucket, with the option of specifying the pivot year for * two-digit year parsing. * * @param instantLocal the initial millis from 1970-01-01T00:00:00, local time * @param chrono the chronology to use * @param locale the locale to use * @param pivotYear the pivot year to use when parsing two-digit years * @since 2.0 */ public DateTimeParserBucket(long instantLocal, Chronology chrono, Locale locale, Integer pivotYear, int defaultYear) { super(); chrono = DateTimeUtils.getChronology(chrono); iMillis = instantLocal; iZone = chrono.getZone(); iChrono = chrono.withUTC(); iLocale = (locale == null ? Locale.getDefault() : locale); iPivotYear = pivotYear; iDefaultYear = defaultYear; }
Example 9
Source File: DateTimeParserBucket.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Constructs a bucket, with the option of specifying the pivot year for * two-digit year parsing. * * @param instantLocal the initial millis from 1970-01-01T00:00:00, local time * @param chrono the chronology to use * @param locale the locale to use * @param pivotYear the pivot year to use when parsing two-digit years * @since 2.0 */ public DateTimeParserBucket(long instantLocal, Chronology chrono, Locale locale, Integer pivotYear, int defaultYear) { super(); chrono = DateTimeUtils.getChronology(chrono); iMillis = instantLocal; iZone = chrono.getZone(); iChrono = chrono.withUTC(); iLocale = (locale == null ? Locale.getDefault() : locale); iPivotYear = pivotYear; iDefaultYear = defaultYear; }
Example 10
Source File: ZonedChronology.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Create a ZonedChronology for any chronology, overriding any time zone it * may already have. * * @param base base chronology to wrap * @param zone the time zone * @throws IllegalArgumentException if chronology or time zone is null */ public static ZonedChronology getInstance(Chronology base, DateTimeZone zone) { if (base == null) { throw new IllegalArgumentException("Must supply a chronology"); } base = base.withUTC(); if (base == null) { throw new IllegalArgumentException("UTC chronology must not be null"); } if (zone == null) { throw new IllegalArgumentException("DateTimeZone must not be null"); } return new ZonedChronology(base, zone); }
Example 11
Source File: BasePartial.java From astor with GNU General Public License v2.0 | 3 votes |
/** * Constructs a partial from an Object that represents a time, using the * specified chronology. * <p> * The recognised object types are defined in * {@link org.joda.time.convert.ConverterManager ConverterManager} and * include ReadableInstant, String, Calendar and Date. * <p> * The constructor uses the time zone of the chronology specified. * Once the constructor is complete, all further calculations are performed * without reference to a timezone (by switching to UTC). * * @param instant the datetime object * @param chronology the chronology, null means use converter * @param parser if converting from a String, the given parser is preferred * @throws IllegalArgumentException if the date is invalid * @since 1.3 */ protected BasePartial(Object instant, Chronology chronology, DateTimeFormatter parser) { super(); PartialConverter converter = ConverterManager.getInstance().getPartialConverter(instant); chronology = converter.getChronology(instant, chronology); chronology = DateTimeUtils.getChronology(chronology); iChronology = chronology.withUTC(); iValues = converter.getPartialValues(this, instant, chronology, parser); }
Example 12
Source File: BasePartial.java From astor with GNU General Public License v2.0 | 3 votes |
/** * Constructs a partial with specified time field values and chronology. * <p> * The constructor uses the time zone of the chronology specified. * Once the constructor is complete, all further calculations are performed * without reference to a timezone (by switching to UTC). * <p> * The array of values is assigned (not cloned) to the new instance. * * @param values the new set of values * @param chronology the chronology, null means ISOChronology in the default zone * @throws IllegalArgumentException if the values are invalid */ protected BasePartial(int[] values, Chronology chronology) { super(); chronology = DateTimeUtils.getChronology(chronology); iChronology = chronology.withUTC(); chronology.validate(this, values); iValues = values; }
Example 13
Source File: BasePartial.java From astor with GNU General Public License v2.0 | 3 votes |
/** * Constructs a partial from an Object that represents a time, using the * specified chronology. * <p> * The recognised object types are defined in * {@link org.joda.time.convert.ConverterManager ConverterManager} and * include ReadableInstant, String, Calendar and Date. * <p> * The constructor uses the time zone of the chronology specified. * Once the constructor is complete, all further calculations are performed * without reference to a timezone (by switching to UTC). * * @param instant the datetime object * @param chronology the chronology, null means use converter * @param parser if converting from a String, the given parser is preferred * @throws IllegalArgumentException if the date is invalid * @since 1.3 */ protected BasePartial(Object instant, Chronology chronology, DateTimeFormatter parser) { super(); PartialConverter converter = ConverterManager.getInstance().getPartialConverter(instant); chronology = converter.getChronology(instant, chronology); chronology = DateTimeUtils.getChronology(chronology); iChronology = chronology.withUTC(); iValues = converter.getPartialValues(this, instant, chronology, parser); }
Example 14
Source File: BasePartial.java From astor with GNU General Public License v2.0 | 3 votes |
/** * Constructs a partial from an Object that represents a time, using the * specified chronology. * <p> * The recognised object types are defined in * {@link org.joda.time.convert.ConverterManager ConverterManager} and * include ReadableInstant, String, Calendar and Date. * <p> * The constructor uses the time zone of the chronology specified. * Once the constructor is complete, all further calculations are performed * without reference to a timezone (by switching to UTC). * * @param instant the datetime object * @param chronology the chronology, null means use converter * @throws IllegalArgumentException if the date is invalid */ protected BasePartial(Object instant, Chronology chronology) { super(); PartialConverter converter = ConverterManager.getInstance().getPartialConverter(instant); chronology = converter.getChronology(instant, chronology); chronology = DateTimeUtils.getChronology(chronology); iChronology = chronology.withUTC(); iValues = converter.getPartialValues(this, instant, chronology); }
Example 15
Source File: BasePartial.java From astor with GNU General Public License v2.0 | 3 votes |
/** * Constructs a partial extracting the partial fields from the specified * milliseconds using the chronology provided. * <p> * The constructor uses the time zone of the chronology specified. * Once the constructor is complete, all further calculations are performed * without reference to a timezone (by switching to UTC). * * @param instant the milliseconds from 1970-01-01T00:00:00Z * @param chronology the chronology, null means ISOChronology in the default zone */ protected BasePartial(long instant, Chronology chronology) { super(); chronology = DateTimeUtils.getChronology(chronology); iChronology = chronology.withUTC(); iValues = chronology.get(this, instant); }
Example 16
Source File: BasePartial.java From astor with GNU General Public License v2.0 | 3 votes |
/** * Constructs a partial with specified time field values and chronology. * <p> * The constructor uses the time zone of the chronology specified. * Once the constructor is complete, all further calculations are performed * without reference to a timezone (by switching to UTC). * <p> * The array of values is assigned (not cloned) to the new instance. * * @param values the new set of values * @param chronology the chronology, null means ISOChronology in the default zone * @throws IllegalArgumentException if the values are invalid */ protected BasePartial(int[] values, Chronology chronology) { super(); chronology = DateTimeUtils.getChronology(chronology); iChronology = chronology.withUTC(); chronology.validate(this, values); iValues = values; }
Example 17
Source File: HourMinuteSecond.java From fenixedu-academic with GNU Lesser General Public License v3.0 | 3 votes |
/** * Creates a new HourMinuteSecond instance with the specified chronology. * This instance is immutable and unaffected by this method call. * <p> * This method retains the values of the fields, thus the result will typically refer to a different instant. * <p> * The time zone of the specified chronology is ignored, as HourMinuteSecond operates without a time zone. * * @param newChronology * the new chronology, null means ISO * @return a copy of this datetime with a different chronology * @throws IllegalArgumentException * if the values are invalid for the new chronology */ public HourMinuteSecond withChronologyRetainFields(Chronology newChronology) { newChronology = DateTimeUtils.getChronology(newChronology); newChronology = newChronology.withUTC(); if (newChronology == getChronology()) { return this; } else { HourMinuteSecond newHourMinuteSecond = new HourMinuteSecond(this, newChronology); newChronology.validate(newHourMinuteSecond, getValues()); return newHourMinuteSecond; } }
Example 18
Source File: BasePartial.java From astor with GNU General Public License v2.0 | 3 votes |
/** * Constructs a partial extracting the partial fields from the specified * milliseconds using the chronology provided. * <p> * The constructor uses the time zone of the chronology specified. * Once the constructor is complete, all further calculations are performed * without reference to a timezone (by switching to UTC). * * @param instant the milliseconds from 1970-01-01T00:00:00Z * @param chronology the chronology, null means ISOChronology in the default zone */ protected BasePartial(long instant, Chronology chronology) { super(); chronology = DateTimeUtils.getChronology(chronology); iChronology = chronology.withUTC(); iValues = chronology.get(this, instant); }
Example 19
Source File: BasePartial.java From astor with GNU General Public License v2.0 | 2 votes |
/** * Private constructor to be used by subclasses only which performs no validation. * <p> * Data is assigned (not cloned) to the new instance. * This should not be used by mutable subclasses. * * @param base the base partial * @param chrono the chronology to use, null means use base */ protected BasePartial(BasePartial base, Chronology chrono) { super(); iChronology = chrono.withUTC(); iValues = base.iValues; }
Example 20
Source File: BasePartial.java From astor with GNU General Public License v2.0 | 2 votes |
/** * Private constructor to be used by subclasses only which performs no validation. * <p> * Data is assigned (not cloned) to the new instance. * This should not be used by mutable subclasses. * * @param base the base partial * @param chrono the chronology to use, null means use base */ protected BasePartial(BasePartial base, Chronology chrono) { super(); iChronology = chrono.withUTC(); iValues = base.iValues; }