LocalDateTime (Java SE 25 & JDK 25)
- All Implemented Interfaces:
Serializable, Comparable<ChronoLocalDateTime<?>>, ChronoLocalDateTime<LocalDate>, Temporal, TemporalAccessor, TemporalAdjuster
-
Field Summary
Fields
The maximum supported
LocalDateTime, '+999999999-12-31T23:59:59.999999999'.The minimum supported
LocalDateTime, '-999999999-01-01T00:00:00'. -
Method Summary
Adjusts the specified temporal object to have the same date and time as this object.
Combines this date-time with an offset to create an
OffsetDateTime.Combines this date-time with a time-zone to create a
ZonedDateTime.intCompares this date-time to another date-time.
booleanChecks if this date-time is equal to another date-time.
Formats this date-time using the specified formatter.
Obtains an instance of
LocalDateTimefrom a temporal object.intGets the value of the specified field from this date-time as an
int.intGets the day-of-month field.
Gets the day-of-week field, which is an enum
DayOfWeek.intGets the day-of-year field.
intgetHour()Gets the hour-of-day field.
longGets the value of the specified field from this date-time as a
long.intGets the minute-of-hour field.
getMonth()Gets the month-of-year field using the
Monthenum.intGets the month-of-year field from 1 to 12.
intgetNano()Gets the nano-of-second field.
intGets the second-of-minute field.
intgetYear()inthashCode()A hash code for this date-time.
booleanChecks if this date-time is after the specified date-time.
booleanChecks if this date-time is before the specified date-time.
booleanChecks if this date-time is equal to the specified date-time.
booleanChecks if the specified field is supported.
booleanChecks if the specified unit is supported.
Returns a copy of this date-time with the specified amount subtracted.
Returns a copy of this date-time with the specified amount subtracted.
minusDays(long days) Returns a copy of this
LocalDateTimewith the specified number of days subtracted.minusHours(long hours) Returns a copy of this
LocalDateTimewith the specified number of hours subtracted.minusMinutes(long minutes) Returns a copy of this
LocalDateTimewith the specified number of minutes subtracted.minusMonths(long months) Returns a copy of this
LocalDateTimewith the specified number of months subtracted.minusNanos(long nanos) Returns a copy of this
LocalDateTimewith the specified number of nanoseconds subtracted.minusSeconds(long seconds) Returns a copy of this
LocalDateTimewith the specified number of seconds subtracted.minusWeeks(long weeks) Returns a copy of this
LocalDateTimewith the specified number of weeks subtracted.minusYears(long years) Returns a copy of this
LocalDateTimewith the specified number of years subtracted.now()Obtains the current date-time from the system clock in the default time-zone.
Obtains the current date-time from the specified clock.
Obtains the current date-time from the system clock in the specified time-zone.
of(int year, int month, int dayOfMonth, int hour, int minute) Obtains an instance of
LocalDateTimefrom year, month, day, hour and minute, setting the second and nanosecond to zero.of(int year, int month, int dayOfMonth, int hour, int minute, int second) Obtains an instance of
LocalDateTimefrom year, month, day, hour, minute and second, setting the nanosecond to zero.of(int year, int month, int dayOfMonth, int hour, int minute, int second, int nanoOfSecond) Obtains an instance of
LocalDateTimefrom year, month, day, hour, minute, second and nanosecond.of(int year, Month month, int dayOfMonth, int hour, int minute) Obtains an instance of
LocalDateTimefrom year, month, day, hour and minute, setting the second and nanosecond to zero.of(int year, Month month, int dayOfMonth, int hour, int minute, int second) Obtains an instance of
LocalDateTimefrom year, month, day, hour, minute and second, setting the nanosecond to zero.of(int year, Month month, int dayOfMonth, int hour, int minute, int second, int nanoOfSecond) Obtains an instance of
LocalDateTimefrom year, month, day, hour, minute, second and nanosecond.Obtains an instance of
LocalDateTimefrom a date and time.ofEpochSecond(long epochSecond, int nanoOfSecond, ZoneOffset offset) Obtains an instance of
LocalDateTimeusing seconds from the epoch of 1970-01-01T00:00:00Z.Obtains an instance of
LocalDateTimefrom anInstantand zone ID.Obtains an instance of
LocalDateTimefrom a text string such as2007-12-03T10:15:30.Obtains an instance of
LocalDateTimefrom a text string using a specific formatter.Returns a copy of this date-time with the specified amount added.
Returns a copy of this date-time with the specified amount added.
plusDays(long days) Returns a copy of this
LocalDateTimewith the specified number of days added.plusHours(long hours) Returns a copy of this
LocalDateTimewith the specified number of hours added.plusMinutes(long minutes) Returns a copy of this
LocalDateTimewith the specified number of minutes added.plusMonths(long months) Returns a copy of this
LocalDateTimewith the specified number of months added.plusNanos(long nanos) Returns a copy of this
LocalDateTimewith the specified number of nanoseconds added.plusSeconds(long seconds) Returns a copy of this
LocalDateTimewith the specified number of seconds added.plusWeeks(long weeks) Returns a copy of this
LocalDateTimewith the specified number of weeks added.plusYears(long years) Returns a copy of this
LocalDateTimewith the specified number of years added.<R> RQueries this date-time using the specified query.
Gets the range of valid values for the specified field.
Gets the
LocalDatepart of this date-time.Gets the
LocalTimepart of this date-time.toString()Outputs this date-time as a
String, such as2007-12-03T10:15:30.Returns a copy of this
LocalDateTimewith the time truncated.longCalculates the amount of time until another date-time in terms of the specified unit.
Returns an adjusted copy of this date-time.
Returns a copy of this date-time with the specified field set to a new value.
withDayOfMonth(int dayOfMonth) Returns a copy of this
LocalDateTimewith the day-of-month altered.withDayOfYear(int dayOfYear) Returns a copy of this
LocalDateTimewith the day-of-year altered.withHour(int hour) Returns a copy of this
LocalDateTimewith the hour-of-day altered.withMinute(int minute) Returns a copy of this
LocalDateTimewith the minute-of-hour altered.withMonth(int month) Returns a copy of this
LocalDateTimewith the month-of-year altered.withNano(int nanoOfSecond) Returns a copy of this
LocalDateTimewith the nano-of-second altered.withSecond(int second) Returns a copy of this
LocalDateTimewith the second-of-minute altered.withYear(int year) Returns a copy of this
LocalDateTimewith the year altered.
-
Field Details
-
MIN
-
MAX
-
-
Method Details
-
now
-
now
-
now
-
of
-
of
-
of
-
of
-
of
-
of
-
of
-
ofInstant
-
ofEpochSecond
-
from
-
parse
-
parse
-
isSupported
-
isSupported
-
range
-
get
-
getLong
-
toLocalDate
-
getYear
-
getMonthValue
-
getMonth
-
getDayOfMonth
-
getDayOfYear
-
getDayOfWeek
-
toLocalTime
-
getHour
-
getMinute
-
getSecond
-
getNano
-
with
-
with
-
withYear
-
withMonth
-
withDayOfMonth
-
withDayOfYear
-
withHour
-
withMinute
-
withSecond
-
withNano
-
truncatedTo
-
plus
-
plus
-
plusYears
-
plusMonths
-
plusWeeks
-
plusDays
-
plusHours
-
plusMinutes
-
plusSeconds
-
plusNanos
-
minus
-
minus
-
minusYears
-
minusMonths
-
minusWeeks
-
minusDays
-
minusHours
-
minusMinutes
-
minusSeconds
-
minusNanos
-
query
-
adjustInto
-
until
-
format
-
atOffset
-
atZone
-
compareTo
-
isAfter
-
isBefore
-
isEqual
-
equals
-
hashCode
-
toString
-