![]() ![]() This datetime instance is immutable and unaffected by this method call. In the time being within the cutover then the time is adjusted to beĭateTime subtracted = dt.minus(Period.days(6)) ĭateTime subtracted = dt.withFieldAdded(DurationFieldType.days(), -6) Returns a copy of this datetime minus the specified number of days. plusHours public DateTime plusHours(int hours).Parameters: days - the amount of days to add, may be negative Returns: the new datetime plus the increased days Since: 1.1 The following three lines are identical in effect:ĭateTime added = dt.plus(Period.days(6)) ĭateTime added = dt.withFieldAdded(DurationFieldType.days(), 6) For example, if the cutover is from 01:59 to 03:00Īnd the result of this method would have been 02:30, then the result The time being within the cutover then the time is adjusted to be It may be necessary to alter the time fields. However, in certain circumstances, typically daylight savings cutover, The calculation will do its best to only change the day field Returns a copy of this datetime plus the specified number of days. parse public static DateTime parse( String str,.Parameters: str - the string to parse, not null Returns: the parsed date-time, not null Since: 2.0 The object produced via the constructor has a zone of DateTimeZone.getDefault(). The object produced via this method has a zone of DateTimeZone.forOffsetHours(2). The offset is directly parsed and stored.Īs such, DateTime.parse("T01:20+02:00") and However, when this method is passed a date-time string with an offset, When passed a date-time string without an offset, such as 'T01:20',īoth the constructor and this method use the default time-zone. This can be confusing as the difference is not visible in AbstractDateTime.toString(). Sometimes this method and new DateTime(str) return different results. Which is different to passing a String to the constructor. This uses ISODateTimeFormat.dateTimeParser(). Parses a DateTime from the specified string. Methods inherited from interface java.lang.ReadableInstant equals, get, getChronology, getMillis, getZone, hashCode, isAfter, isBefore, isEqual, isSupported, toInstant, toString ReadableDateTime getCenturyOfEra, getDayOfMonth, getDayOfWeek, getDayOfYear, getEra, getHourOfDay, getMillisOfDay, getMillisOfSecond, getMinuteOfDay, getMinuteOfHour, getMonthOfYear, getSecondOfDay, getSecondOfMinute, getWeekOfWeekyear, getWeekyear, getYear, getYearOfCentury, getYearOfEra, toMutableDateTime, toString, toString Object clone, finalize, getClass, notify, notifyAll, wait, wait, wait Methods inherited from class java.lang.AbstractInstant compareTo, equals, get, getZone, hashCode, isAfter, isAfter, isAfterNow, isBefore, isBefore, isBeforeNow, isEqual, isEqual, isEqualNow, isSupported, toDate, toInstant, toMutableDateTime, toMutableDateTime, toMutableDateTime, toMutableDateTimeISO, toString ![]() AbstractDateTime get, getCenturyOfEra, getDayOfMonth, getDayOfWeek, getDayOfYear, getEra, getHourOfDay, getMillisOfDay, getMillisOfSecond, getMinuteOfDay, getMinuteOfHour, getMonthOfYear, getSecondOfDay, getSecondOfMinute, getWeekOfWeekyear, getWeekyear, getYear, getYearOfCentury, getYearOfEra, toCalendar, toGregorianCalendar, toString, toString, toString BaseDateTime checkChronology, checkInstant, getChronology, getMillis, setChronology, setMillis Get the year of era property which provides access to advanced functionality. The second technique also provides access to other useful methods on theĭateTime is thread-safe and immutable, provided that the Chronology is as well.Īll standard Chronology classes supplied are thread-safe and immutable. International standard and compatible with the modern Gregorian calendar.Įach individual field can be queried in two ways: The default Chronology is ISOChronology which is the agreed Millisecond instant value is converted into the date time fields. Secondly, it holds a Chronology which determines how the Firstly, it holds theĭatetime as milliseconds from the Java epoch of. Internally, the class holds two pieces of data. Point on the time-line, but limited to the precision of milliseconds.Ī DateTime calculates its fields with respect to a As with all instants, it represents an exact DateTime is the standard implementation of an unmodifiable datetime class.ĭateTime is the most widely used implementation of
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |