The maximum supported LocalDateTime
, '+999999999-12-31T23:59:59.999999999'.
The maximum supported LocalDateTime
, '+999999999-12-31T23:59:59.999999999'.
This is the local date-time just before midnight at the end of the maximum date.
This combines LocalDate#MAX
and LocalTime#MAX
.
This could be used by an application as a "far future" date-time.
The minimum supported LocalDateTime
, '-999999999-01-01T00:00:00'.
The minimum supported LocalDateTime
, '-999999999-01-01T00:00:00'.
This is the local date-time of midnight at the start of the minimum date.
This combines LocalDate#MIN
and LocalTime#MIN
.
This could be used by an application as a "far past" date-time.
Obtains an instance of LocalDateTime
from a temporal object.
Obtains an instance of LocalDateTime
from a temporal object.
A TemporalAccessor
represents some form of date and time information.
This factory converts the arbitrary temporal object to an instance of LocalDateTime
.
The conversion extracts and combines LocalDate
and LocalTime
.
This method matches the signature of the functional interface TemporalQuery
allowing it to be used as a query via method reference, LocalDateTime::from
.
the temporal object to convert, not null
the local date-time, not null
DateTimeException
if unable to convert to a { @code LocalDateTime}
Obtains the current date-time from the specified clock.
Obtains the current date-time from the specified clock.
This will query the specified clock to obtain the current date-time.
Using this method allows the use of an alternate clock for testing.
The alternate clock may be introduced using dependency injection
.
the clock to use, not null
the current date-time, not null
Obtains the current date-time from the system clock in the specified time-zone.
Obtains the current date-time from the system clock in the specified time-zone.
This will query the system clock
to obtain the current date-time.
Specifying the time-zone avoids dependence on the default time-zone.
Using this method will prevent the ability to use an alternate clock for testing because the clock is hard-coded.
the zone ID to use, not null
the current date-time using the system clock, not null
Obtains the current date-time from the system clock in the default time-zone.
Obtains the current date-time from the system clock in the default time-zone.
This will query the system clock
in the default
time-zone to obtain the current date-time.
Using this method will prevent the ability to use an alternate clock for testing because the clock is hard-coded.
the current date-time using the system clock and default time-zone, not null
Obtains an instance of LocalDateTime
from a date and time.
Obtains an instance of LocalDateTime
from a date and time.
the local date, not null
the local time, not null
the local date-time, not null
Obtains an instance of LocalDateTime
from year, month,
day, hour, minute, second and nanosecond.
Obtains an instance of LocalDateTime
from year, month,
day, hour, minute, second and nanosecond.
The day must be valid for the year and month, otherwise an exception will be thrown.
the year to represent, from MIN_YEAR to MAX_YEAR
the month-of-year to represent, from 1 (January) to 12 (December)
the day-of-month to represent, from 1 to 31
the hour-of-day to represent, from 0 to 23
the minute-of-hour to represent, from 0 to 59
the second-of-minute to represent, from 0 to 59
the nano-of-second to represent, from 0 to 999,999,999
the local date-time, not null
DateTimeException
if the day-of-month is invalid for the month-year
Obtains an instance of LocalDateTime
from year, month,
day, hour, minute and second, setting the nanosecond to zero.
Obtains an instance of LocalDateTime
from year, month,
day, hour, minute and second, setting the nanosecond to zero.
The day must be valid for the year and month, otherwise an exception will be thrown. The nanosecond field will be set to zero.
the year to represent, from MIN_YEAR to MAX_YEAR
the month-of-year to represent, from 1 (January) to 12 (December)
the day-of-month to represent, from 1 to 31
the hour-of-day to represent, from 0 to 23
the minute-of-hour to represent, from 0 to 59
the second-of-minute to represent, from 0 to 59
the local date-time, not null
DateTimeException
if the day-of-month is invalid for the month-year
Obtains an instance of LocalDateTime
from year, month,
day, hour and minute, setting the second and nanosecond to zero.
Obtains an instance of LocalDateTime
from year, month,
day, hour and minute, setting the second and nanosecond to zero.
The day must be valid for the year and month, otherwise an exception will be thrown. The second and nanosecond fields will be set to zero.
the year to represent, from MIN_YEAR to MAX_YEAR
the month-of-year to represent, from 1 (January) to 12 (December)
the day-of-month to represent, from 1 to 31
the hour-of-day to represent, from 0 to 23
the minute-of-hour to represent, from 0 to 59
the local date-time, not null
DateTimeException
if the day-of-month is invalid for the month-year
Obtains an instance of LocalDateTime
from year, month,
day, hour, minute, second and nanosecond.
Obtains an instance of LocalDateTime
from year, month,
day, hour, minute, second and nanosecond.
The day must be valid for the year and month, otherwise an exception will be thrown.
the year to represent, from MIN_YEAR to MAX_YEAR
the month-of-year to represent, not null
the day-of-month to represent, from 1 to 31
the hour-of-day to represent, from 0 to 23
the minute-of-hour to represent, from 0 to 59
the second-of-minute to represent, from 0 to 59
the nano-of-second to represent, from 0 to 999,999,999
the local date-time, not null
DateTimeException
if the day-of-month is invalid for the month-year
Obtains an instance of LocalDateTime
from year, month,
day, hour, minute and second, setting the nanosecond to zero.
Obtains an instance of LocalDateTime
from year, month,
day, hour, minute and second, setting the nanosecond to zero.
The day must be valid for the year and month, otherwise an exception will be thrown. The nanosecond field will be set to zero.
the year to represent, from MIN_YEAR to MAX_YEAR
the month-of-year to represent, not null
the day-of-month to represent, from 1 to 31
the hour-of-day to represent, from 0 to 23
the minute-of-hour to represent, from 0 to 59
the second-of-minute to represent, from 0 to 59
the local date-time, not null
DateTimeException
if the day-of-month is invalid for the month-year
Obtains an instance of LocalDateTime
from year, month,
day, hour and minute, setting the second and nanosecond to zero.
Obtains an instance of LocalDateTime
from year, month,
day, hour and minute, setting the second and nanosecond to zero.
The day must be valid for the year and month, otherwise an exception will be thrown. The second and nanosecond fields will be set to zero.
the year to represent, from MIN_YEAR to MAX_YEAR
the month-of-year to represent, not null
the day-of-month to represent, from 1 to 31
the hour-of-day to represent, from 0 to 23
the minute-of-hour to represent, from 0 to 59
the local date-time, not null
DateTimeException
if the day-of-month is invalid for the month-year
Obtains an instance of LocalDateTime
using seconds from the
epoch of 1970-01-01T00:00:00Z.
Obtains an instance of LocalDateTime
using seconds from the
epoch of 1970-01-01T00:00:00Z.
This allows the epoch-second
field
to be converted to a local date-time. This is primarily intended for
low-level conversions rather than general application usage.
the number of seconds from the epoch of 1970-01-01T00:00:00Z
the nanosecond within the second, from 0 to 999,999,999
the zone offset, not null
the local date-time, not null
DateTimeException
if the result exceeds the supported range
Obtains an instance of LocalDateTime
from an Instant
and zone ID.
Obtains an instance of LocalDateTime
from an Instant
and zone ID.
This creates a local date-time based on the specified instant. First, the offset from UTC/Greenwich is obtained using the zone ID and instant, which is simple as there is only one valid offset for each instant. Then, the instant and offset are used to calculate the local date-time.
the instant to create the date-time from, not null
the time-zone, which may be an offset, not null
the local date-time, not null
DateTimeException
if the result exceeds the supported range
Obtains an instance of LocalDateTime
from a text string using a specific formatter.
Obtains an instance of LocalDateTime
from a text string using a specific formatter.
The text is parsed using the formatter, returning a date-time.
the text to parse, not null
the formatter to use, not null
the parsed local date-time, not null
DateTimeParseException
if the text cannot be parsed
Obtains an instance of LocalDateTime
from a text string such as 2007-12-03T10:15:30
.
Obtains an instance of LocalDateTime
from a text string such as 2007-12-03T10:15:30
.
The string must represent a valid date-time and is parsed using
org.threeten.bp.format.DateTimeFormatter#ISO_LOCAL_DATE_TIME
.
the text to parse such as "2007-12-03T10:15:30", not null
the parsed local date-time, not null
DateTimeParseException
if the text cannot be parsed