List of usage examples for org.joda.time Chronology set
public abstract long set(ReadablePartial partial, long instant);
From source file:net.sourceforge.fenixedu.util.HourMinuteSecond.java
License:Open Source License
/** * Converts this partial to a full datetime using the specified time zone * setting the date fields from this instance and the time fields from the * current time.//w ww .j av a 2s . c o m * <p> * This method uses the chronology from this instance plus the time zone specified. * * @param zone * the zone to use, null means default * @return this date as a datetime with the time as the current time */ public DateTime toDateTimeAtCurrentTime(DateTimeZone zone) { Chronology chrono = getChronology().withZone(zone); long instantMillis = DateTimeUtils.currentTimeMillis(); long resolved = chrono.set(this, instantMillis); return new DateTime(resolved, chrono); }
From source file:net.sourceforge.fenixedu.util.HourMinuteSecond.java
License:Open Source License
/** * Converts this object to a DateTime using a TimeOfDay to fill in the * missing fields. This instance is immutable and unaffected by this method * call./*from ww w.j a v a 2 s. co m*/ * <p> * The resulting chronology is determined by the chronology of this HourMinuteSecond plus the time zone. The chronology of the * time is ignored - only the field values are used. * * @param time * the time of day to use, null means current time * @param zone * the zone to get the DateTime in, null means default * @return the DateTime instance */ public DateTime toDateTime(TimeOfDay time, DateTimeZone zone) { Chronology chrono = getChronology().withZone(zone); long instant = DateTimeUtils.currentTimeMillis(); instant = chrono.set(this, instant); if (time != null) { instant = chrono.set(time, instant); } return new DateTime(instant, chrono); }