LocalDateTime
class LocalDateTime : ChronoLocalDateTime<LocalDate!>, Serializable, Temporal, TemporalAdjuster
| kotlin.Any | |
| ↳ | java.time.LocalDateTime |
A date-time without a time-zone in the ISO-8601 calendar system, such as 2007-12-03T10:15:30.
LocalDateTime is an immutable date-time object that represents a date-time, often viewed as year-month-day-hour-minute-second. Other date and time fields, such as day-of-year, day-of-week and week-of-year, can also be accessed. Time is represented to nanosecond precision. For example, the value "2nd October 2007 at 13:45.30.123456789" can be stored in a LocalDateTime.
This class does not store or represent a time-zone. Instead, it is a description of the date, as used for birthdays, combined with the local time as seen on a wall clock. It cannot represent an instant on the time-line without additional information such as an offset or time-zone.
The ISO-8601 calendar system is the modern civil calendar system used today in most of the world. It is equivalent to the proleptic Gregorian calendar system, in which today's rules for leap years are applied for all time. For most applications written today, the ISO-8601 rules are entirely suitable. However, any application that makes use of historical dates, and requires them to be accurate will find the ISO-8601 approach unsuitable.
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 date and time as this object. |
| OffsetDateTime! |
atOffset(offset: ZoneOffset!)Combines this date-time with an offset to create an |
| ZonedDateTime! |
Combines this date-time with a time-zone to create a |
| Int |
compareTo(other: ChronoLocalDateTime<*>!)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 LocalDateTime! |
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. |
| 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: ChronoLocalDateTime<*>!)Checks if this date-time is after the specified date-time. |
| Boolean |
isBefore(other: ChronoLocalDateTime<*>!)Checks if this date-time is before the specified date-time. |
| Boolean |
isEqual(other: ChronoLocalDateTime<*>!)Checks if this date-time is equal to 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. |
| LocalDateTime! |
minus(amountToSubtract: TemporalAmount!)Returns a copy of this date-time with the specified amount subtracted. |
| LocalDateTime! |
minus(amountToSubtract: Long, unit: TemporalUnit!)Returns a copy of this date-time with the specified amount subtracted. |
| LocalDateTime! |
Returns a copy of this |
| LocalDateTime! |
minusHours(hours: Long)Returns a copy of this |
| LocalDateTime! |
minusMinutes(minutes: Long)Returns a copy of this |
| LocalDateTime! |
minusMonths(months: Long)Returns a copy of this |
| LocalDateTime! |
minusNanos(nanos: Long)Returns a copy of this |
| LocalDateTime! |
minusSeconds(seconds: Long)Returns a copy of this |
| LocalDateTime! |
minusWeeks(weeks: Long)Returns a copy of this |
| LocalDateTime! |
minusYears(years: Long)Returns a copy of this |
| static LocalDateTime! |
now()Obtains the current date-time from the system clock in the default time-zone. |
| static LocalDateTime! |
Obtains the current date-time from the specified clock. |
| static LocalDateTime! |
Obtains the current date-time from the system clock in the specified time-zone. |
| static LocalDateTime! |
Obtains an instance of |
| static LocalDateTime! |
Obtains an instance of |
| static LocalDateTime! |
Obtains an instance of |
| static LocalDateTime! |
Obtains an instance of |
| static LocalDateTime! |
Obtains an instance of |
| static LocalDateTime! |
of(year: Int, month: Month!, dayOfMonth: Int, hour: Int, minute: Int, second: Int, nanoOfSecond: Int)Obtains an instance of |
| static LocalDateTime! |
Obtains an instance of |
| static LocalDateTime! |
ofEpochSecond(epochSecond: Long, nanoOfSecond: Int, offset: ZoneOffset!)Obtains an instance of |
| static LocalDateTime! |
Obtains an instance of |
| static LocalDateTime! |
parse(text: CharSequence!)Obtains an instance of |
| static LocalDateTime! |
parse(text: CharSequence!, formatter: DateTimeFormatter!)Obtains an instance of |
| LocalDateTime! |
plus(amountToAdd: TemporalAmount!)Returns a copy of this date-time with the specified amount added. |
| LocalDateTime! |
plus(amountToAdd: Long, unit: TemporalUnit!)Returns a copy of this date-time with the specified amount added. |
| LocalDateTime! |
Returns a copy of this |
| LocalDateTime! |
Returns a copy of this |
| LocalDateTime! |
plusMinutes(minutes: Long)Returns a copy of this |
| LocalDateTime! |
plusMonths(months: Long)Returns a copy of this |
| LocalDateTime! |
Returns a copy of this |
| LocalDateTime! |
plusSeconds(seconds: Long)Returns a copy of this |
| LocalDateTime! |
Returns a copy of this |
| LocalDateTime! |
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. |
| LocalDate! |
Gets the |
| LocalTime! |
Gets the |
| String |
toString()Outputs this date-time as a |
| LocalDateTime! |
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. |
| LocalDateTime! |
with(adjuster: TemporalAdjuster!)Returns an adjusted copy of this date-time. |
| LocalDateTime! |
with(field: TemporalField!, newValue: Long)Returns a copy of this date-time with the specified field set to a new value. |
| LocalDateTime! |
withDayOfMonth(dayOfMonth: Int)Returns a copy of this |
| LocalDateTime! |
withDayOfYear(dayOfYear: Int)Returns a copy of this |
| LocalDateTime! |
Returns a copy of this |
| LocalDateTime! |
withMinute(minute: Int)Returns a copy of this |
| LocalDateTime! |
Returns a copy of this |
| LocalDateTime! |
Returns a copy of this |
| LocalDateTime! |
withSecond(second: Int)Returns a copy of this |
| LocalDateTime! |
Returns a copy of this |
| Inherited functions | |
|---|---|