/** * Obtains a {@code MutableDateTime} set to the current system millisecond time * using <code>ISOChronology</code> in the default time zone. * * @return the current date-time, not null * @since 2.0 */ public static MutableDateTime now() { return new MutableDateTime(); }
/** * Obtains a {@code MutableDateTime} set to the current system millisecond time * using <code>ISOChronology</code> in the default time zone. * * @return the current date-time, not null * @since 2.0 */ public static MutableDateTime now() { return new MutableDateTime(); }
/** * Obtains a {@code MutableDateTime} set to the current system millisecond time * using the specified chronology. * * @param chronology the chronology, not null * @return the current date-time, not null * @since 2.0 */ public static MutableDateTime now(Chronology chronology) { if (chronology == null) { throw new NullPointerException("Chronology must not be null"); } return new MutableDateTime(chronology); }
/** * Obtains a {@code MutableDateTime} set to the current system millisecond time * using <code>ISOChronology</code> in the specified time zone. * * @param zone the time zone, not null * @return the current date-time, not null * @since 2.0 */ public static MutableDateTime now(DateTimeZone zone) { if (zone == null) { throw new NullPointerException("Zone must not be null"); } return new MutableDateTime(zone); }
/** * Obtains a {@code MutableDateTime} set to the current system millisecond time * using <code>ISOChronology</code> in the specified time zone. * * @param zone the time zone, not null * @return the current date-time, not null * @since 2.0 */ public static MutableDateTime now(DateTimeZone zone) { if (zone == null) { throw new NullPointerException("Zone must not be null"); } return new MutableDateTime(zone); }
/** * Obtains a {@code MutableDateTime} set to the current system millisecond time * using the specified chronology. * * @param chronology the chronology, not null * @return the current date-time, not null * @since 2.0 */ public static MutableDateTime now(Chronology chronology) { if (chronology == null) { throw new NullPointerException("Chronology must not be null"); } return new MutableDateTime(chronology); }
/** * Get this object as a MutableDateTime using the given chronology and its zone. * * @param chronology chronology to apply, or ISOChronology if null * @return a MutableDateTime using the same millis */ public MutableDateTime toMutableDateTime(Chronology chronology) { return new MutableDateTime(getMillis(), chronology); }
/** * Get this object as a MutableDateTime using the given chronology and its zone. * * @param chronology chronology to apply, or ISOChronology if null * @return a MutableDateTime using the same millis */ public MutableDateTime toMutableDateTime(Chronology chronology) { return new MutableDateTime(getMillis(), chronology); }
/** * Get this object as a MutableDateTime in the same zone. * * @return a MutableDateTime using the same millis */ public MutableDateTime toMutableDateTime() { return new MutableDateTime(getMillis(), getZone()); }
/** * Get this object as a MutableDateTime in the same zone. * * @return a MutableDateTime using the same millis */ public MutableDateTime toMutableDateTime() { return new MutableDateTime(getMillis(), getZone()); }
private void fillEmptyTimestamps(Map<Long, Map<String, Number>> results) { final long minTimestamp = Collections.min(results.keySet()); final long maxTimestamp = Collections.max(results.keySet()); final MutableDateTime currentTime = new MutableDateTime(minTimestamp, DateTimeZone.UTC); while (currentTime.getMillis() < maxTimestamp) { final Map<String, Number> entry = results.get(currentTime.getMillis()); // advance timestamp by the interval currentTime.add(interval.getPeriod()); if (entry == null) { // synthesize a 0 value for this timestamp results.put(currentTime.getMillis(), EMPTY_RESULT); } } }
/** * Get this object as a MutableDateTime using ISOChronology in the default zone. * <p> * This method returns a MutableDateTime object in the default zone. * This differs from the similarly named method on DateTime, DateMidnight * or MutableDateTime which retains the time zone. The difference is * because Instant really represents a time <i>without</i> a zone, * thus calling this method we really have no zone to 'retain' and * hence expect to switch to the default zone. * <p> * This method definition preserves compatibility with earlier versions * of Joda-Time. * * @return a MutableDateTime using the same millis */ public MutableDateTime toMutableDateTime() { return new MutableDateTime(getMillis(), ISOChronology.getInstance()); }
/** * Get this object as a MutableDateTime using ISOChronology in the default zone. * <p> * This method returns a MutableDateTime object in the default zone. * This differs from the similarly named method on DateTime, DateMidnight * or MutableDateTime which retains the time zone. The difference is * because Instant really represents a time <i>without</i> a zone, * thus calling this method we really have no zone to 'retain' and * hence expect to switch to the default zone. * <p> * This method definition preserves compatibility with earlier versions * of Joda-Time. * * @return a MutableDateTime using the same millis */ public MutableDateTime toMutableDateTime() { return new MutableDateTime(getMillis(), ISOChronology.getInstance()); }
public NumericDateComponent(DateTimeFieldType fieldType, int minDigits, int maxDigits) { this.fieldType = fieldType; this.minDigits = minDigits; this.maxDigits = maxDigits; MutableDateTime dt = new MutableDateTime(0L, DateTimeZone.UTC); MutableDateTime.Property property = dt.property(fieldType); minValue = property.getMinimumValueOverall(); maxValue = property.getMaximumValueOverall(); }
/** * Get this object as a MutableDateTime using ISOChronology in the same zone. * * @return a MutableDateTime using the same millis with ISOChronology */ public MutableDateTime toMutableDateTimeISO() { return new MutableDateTime(getMillis(), ISOChronology.getInstance(getZone())); }
/** * Get this object as a MutableDateTime using ISOChronology in the same zone. * * @return a MutableDateTime using the same millis with ISOChronology */ public MutableDateTime toMutableDateTimeISO() { return new MutableDateTime(getMillis(), ISOChronology.getInstance(getZone())); }
static int parseTime(String str) { DateTimeFormatter p = ISODateTimeFormat.hourMinuteSecondFraction(); MutableDateTime mdt = new MutableDateTime(0, getLenientISOChronology()); int pos = 0; if (str.startsWith("-")) { pos = 1; } int newPos = p.parseInto(mdt, str, pos); if (newPos == ~pos) { throw new IllegalArgumentException(str); } int millis = (int)mdt.getMillis(); if (pos == 1) { millis = -millis; } return millis; }
static int parseTime(String str) { DateTimeFormatter p = ISODateTimeFormat.hourMinuteSecondFraction(); MutableDateTime mdt = new MutableDateTime(0, getLenientISOChronology()); int pos = 0; if (str.startsWith("-")) { pos = 1; } int newPos = p.parseInto(mdt, str, pos); if (newPos == ~pos) { throw new IllegalArgumentException(str); } int millis = (int)mdt.getMillis(); if (pos == 1) { millis = -millis; } return millis; }
/** * Get this object as a MutableDateTime using the same chronology but a different zone. * * @param zone time zone to apply, or default if null * @return a MutableDateTime using the same millis */ public MutableDateTime toMutableDateTime(DateTimeZone zone) { Chronology chrono = DateTimeUtils.getChronology(getChronology()); chrono = chrono.withZone(zone); return new MutableDateTime(getMillis(), chrono); }
/** * Get this object as a MutableDateTime using the same chronology but a different zone. * * @param zone time zone to apply, or default if null * @return a MutableDateTime using the same millis */ public MutableDateTime toMutableDateTime(DateTimeZone zone) { Chronology chrono = DateTimeUtils.getChronology(getChronology()); chrono = chrono.withZone(zone); return new MutableDateTime(getMillis(), chrono); }