OffsetDateTime
class OffsetDateTime : Comparable<OffsetDateTime!>, Serializable, Temporal, TemporalAdjuster
| kotlin.Any | |
| ↳ | java.time.OffsetDateTime |
A date-time with an offset from UTC/Greenwich in the ISO-8601 calendar system, such as 2007-12-03T10:15:30+01:00.
OffsetDateTime is an immutable representation of a date-time with an offset. This class stores all date and time fields, to a precision of nanoseconds, as well as the offset from UTC/Greenwich. For example, the value "2nd October 2007 at 13:45:30.123456789 +02:00" can be stored in an OffsetDateTime.
OffsetDateTime, java.time.ZonedDateTime and java.time.Instant all store an instant on the time-line to nanosecond precision. Instant is the simplest, simply representing the instant. OffsetDateTime adds to the instant the offset from UTC/Greenwich, which allows the local date-time to be obtained. ZonedDateTime adds full time-zone rules.
It is intended that ZonedDateTime or Instant is used to model data in simpler applications. This class may be used when modeling date-time concepts in more detail, or when communicating to a database or in a network protocol.
This is a value-based<> class; programmers should treat instances that are equal as interchangeable and should not use instances for synchronization, or unpredictable behavior may occur. For example, in a future release, synchronization may fail. The equals method should be used for comparisons.
Summary
| Public methods | |
|---|---|
| Temporal! |
adjustInto(temporal: Temporal!)Adjusts the specified temporal object to have the same offset, date and time as this object. |
| ZonedDateTime! |
atZoneSameInstant(zone: ZoneId!)Combines this date-time with a time-zone to create a |
| ZonedDateTime! |
atZoneSimilarLocal(zone: ZoneId!)Combines this date-time with a time-zone to create a |
| Int |
compareTo(other: OffsetDateTime!)Compares this date-time to another date-time. |
| Boolean |
Checks if this date-time is equal to another date-time. |
| String! |
format(formatter: DateTimeFormatter!)Formats this date-time using the specified formatter. |
| static OffsetDateTime! |
from(temporal: TemporalAccessor!)Obtains an instance of |
| Int |
get(field: TemporalField!)Gets the value of the specified field from this date-time as an |
| Int |
Gets the day-of-month field. |
| DayOfWeek! |
Gets the day-of-week field, which is an enum |
| Int |
Gets the day-of-year field. |
| Int |
getHour()Gets the hour-of-day field. |
| Long |
getLong(field: TemporalField!)Gets the value of the specified field from this date-time as a |
| Int |
Gets the minute-of-hour field. |
| Month! |
getMonth()Gets the month-of-year field using the |
| Int |
Gets the month-of-year field from 1 to 12. |
| Int |
getNano()Gets the nano-of-second field. |
| ZoneOffset! |
Gets the zone offset, such as '+01:00'. |
| Int |
Gets the second-of-minute field. |
| Int |
getYear()Gets the year field. |
| Int |
hashCode()A hash code for this date-time. |
| Boolean |
isAfter(other: OffsetDateTime!)Checks if the instant of this date-time is after that of the specified date-time. |
| Boolean |
isBefore(other: OffsetDateTime!)Checks if the instant of this date-time is before that of the specified date-time. |
| Boolean |
isEqual(other: OffsetDateTime!)Checks if the instant of this date-time is equal to that of the specified date-time. |
| Boolean |
isSupported(field: TemporalField!)Checks if the specified field is supported. |
| Boolean |
isSupported(unit: TemporalUnit!)Checks if the specified unit is supported. |
| OffsetDateTime! |
minus(amountToSubtract: TemporalAmount!)Returns a copy of this date-time with the specified amount subtracted. |
| OffsetDateTime! |
minus(amountToSubtract: Long, unit: TemporalUnit!)Returns a copy of this date-time with the specified amount subtracted. |
| OffsetDateTime! |
Returns a copy of this |
| OffsetDateTime! |
minusHours(hours: Long)Returns a copy of this |
| OffsetDateTime! |
minusMinutes(minutes: Long)Returns a copy of this |
| OffsetDateTime! |
minusMonths(months: Long)Returns a copy of this |
| OffsetDateTime! |
minusNanos(nanos: Long)Returns a copy of this |
| OffsetDateTime! |
minusSeconds(seconds: Long)Returns a copy of this |
| OffsetDateTime! |
minusWeeks(weeks: Long)Returns a copy of this |
| OffsetDateTime! |
minusYears(years: Long)Returns a copy of this |
| static OffsetDateTime! |
now()Obtains the current date-time from the system clock in the default time-zone. |
| static OffsetDateTime! |
Obtains the current date-time from the specified clock. |
| static OffsetDateTime! |
Obtains the current date-time from the system clock in the specified time-zone. |
| static OffsetDateTime! |
of(year: Int, month: Int, dayOfMonth: Int, hour: Int, minute: Int, second: Int, nanoOfSecond: Int, offset: ZoneOffset!)Obtains an instance of |
| static OffsetDateTime! |
of(date: LocalDate!, time: LocalTime!, offset: ZoneOffset!)Obtains an instance of |
| static OffsetDateTime! |
of(dateTime: LocalDateTime!, offset: ZoneOffset!)Obtains an instance of |
| static OffsetDateTime! |
Obtains an instance of |
| static OffsetDateTime! |
parse(text: CharSequence!)Obtains an instance of |
| static OffsetDateTime! |
parse(text: CharSequence!, formatter: DateTimeFormatter!)Obtains an instance of |
| OffsetDateTime! |
plus(amountToAdd: TemporalAmount!)Returns a copy of this date-time with the specified amount added. |
| OffsetDateTime! |
plus(amountToAdd: Long, unit: TemporalUnit!)Returns a copy of this date-time with the specified amount added. |
| OffsetDateTime! |
Returns a copy of this OffsetDateTime with the specified number of days added. |
| OffsetDateTime! |
Returns a copy of this |
| OffsetDateTime! |
plusMinutes(minutes: Long)Returns a copy of this |
| OffsetDateTime! |
plusMonths(months: Long)Returns a copy of this |
| OffsetDateTime! |
Returns a copy of this |
| OffsetDateTime! |
plusSeconds(seconds: Long)Returns a copy of this |
| OffsetDateTime! |
Returns a copy of this OffsetDateTime with the specified number of weeks added. |
| OffsetDateTime! |
Returns a copy of this |
| R |
query(query: TemporalQuery<R>!)Queries this date-time using the specified query. |
| ValueRange! |
range(field: TemporalField!)Gets the range of valid values for the specified field. |
| static Comparator<OffsetDateTime!>! |
Gets a comparator that compares two |
| Long |
Converts this date-time to the number of seconds from the epoch of 1970-01-01T00:00:00Z. |
| Instant! |
Converts this date-time to an |
| LocalDate! |
Gets the |
| LocalDateTime! |
Gets the |
| LocalTime! |
Gets the |
| OffsetTime! |
Converts this date-time to an |
| String |
toString()Outputs this date-time as a |
| ZonedDateTime! |
Converts this date-time to a |
| OffsetDateTime! |
truncatedTo(unit: TemporalUnit!)Returns a copy of this |
| Long |
until(endExclusive: Temporal!, unit: TemporalUnit!)Calculates the amount of time until another date-time in terms of the specified unit. |
| OffsetDateTime! |
with(adjuster: TemporalAdjuster!)Returns an adjusted copy of this date-time. |
| OffsetDateTime! |
with(field: TemporalField!, newValue: Long)Returns a copy of this date-time with the specified field set to a new value. |
| OffsetDateTime! |
withDayOfMonth(dayOfMonth: Int)Returns a copy of this |
| OffsetDateTime! |
withDayOfYear(dayOfYear: Int)Returns a copy of this |
| OffsetDateTime! |
Returns a copy of this |
| OffsetDateTime! |
withMinute(minute: Int)Returns a copy of this |
| OffsetDateTime! |
Returns a copy of this |
| OffsetDateTime! |
Returns a copy of this |
| OffsetDateTime! |
withOffsetSameInstant(offset: ZoneOffset!)Returns a copy of this |
| OffsetDateTime! |
withOffsetSameLocal(offset: ZoneOffset!)Returns a copy of this |
| OffsetDateTime! |
withSecond(second: Int)Returns a copy of this |
| OffsetDateTime! |
Returns a copy of this |
| Properties | |
|---|---|
| static OffsetDateTime! |
The maximum supported |
| static OffsetDateTime! |
The minimum supported |