Combines this date-time with an offset to create an OffsetDateTime.
Combines this date-time with a time-zone to create a ZonedDateTime.
Compares this date-time to another date-time.
Formats this date-time using the specified formatter.
Gets the value of the specified field from this date-time as an int.
Gets the day-of-month field. The first day of the month is 1.
Gets the day-of-week field, which is an enum DayOfWeek.
Use the method getValue()
to extract the numeric value of the day
Remember that "Monday" has a getValue of 1, and "Sunday" a getValue of 7
Gets the day-of-year field. The minimum value of this is 1, and the max is 365 or 366 depending on if it is a leapyear
Gets the hour-of-day field. NOTE: from 0 to 23
Gets the value of the specified field from this date-time as a long.
Gets the minute-of-hour field.
Gets the month-of-year field using the Month enum.
Gets the month-of-year field from 1 to 12.
Gets the nano-of-second field.
Gets the second-of-minute field.
Gets the year field.
Checks if this date-time is after the specified date-time.
Checks if this date-time is before the specified date-time.
Checks if this date-time is equal to the specified date-time.
Returns a copy of this date-time with the specified amount subtracted.
Returns a copy of this date-time with the specified amount subtracted.
Returns a copy of this LocalDateTime with the specified number of days subtracted.
Returns a copy of this LocalDateTime with the specified number of hours subtracted.
Returns a copy of this LocalDateTime with the specified number of minutes subtracted.
Returns a copy of this LocalDateTime with the specified number of months subtracted.
Returns a copy of this LocalDateTime with the specified number of nanoseconds subtracted.
Returns a copy of this LocalDateTime with the specified number of seconds subtracted.
Returns a copy of this LocalDateTime with the specified number of weeks subtracted.
Returns a copy of this LocalDateTime with the specified number of years subtracted.
Returns a copy of this date-time with the specified amount added.
Returns a copy of this date-time with the specified amount added.
Returns a copy of this LocalDateTime with the specified number of days added.
Returns a copy of this LocalDateTime with the specified number of hours added.
Returns a copy of this LocalDateTime with the specified number of minutes added.
Returns a copy of this LocalDateTime with the specified number of months added.
Returns a copy of this LocalDateTime with the specified number of nanoseconds added.
Returns a copy of this LocalDateTime with the specified number of seconds added.
Returns a copy of this LocalDateTime with the specified number of weeks added.
Returns a copy of this LocalDateTime with the specified number of years added.
Queries this date-time using the specified query.
Gets the range of valid values for the specified field.
Gets the LocalDate part of this date-time.
Gets the LocalTime part of this date-time.
Returns a copy of this LocalDateTime with the time truncated.
Calculates 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.
Returns a copy of this LocalDateTime with the day-of-month altered.
the day-of-month to set in the result, from 1 to 28-31
Returns a copy of this LocalDateTime with the day-of-year altered.
the day-of-year to set in the result, from 1 to 365-366
Returns a copy of this LocalDateTime with the hour-of-day altered.
the hour-of-day to set in the result, from 0 to 23
Returns a copy of this LocalDateTime with the minute-of-hour altered.
the minute-of-hour to set in the result, from 0 to 59
Returns a copy of this LocalDateTime with the month-of-year altered.
the month-of-year to set in the result, from 1 (January) to 12 (December)
Returns a copy of this LocalDateTime with the nano-of-second altered.
the nano-of-second to set in the result, from 0 to 999,999,999
Returns a copy of this LocalDateTime with the second-of-minute altered.
the second-of-minute to set in the result, from 0 to 59
Returns a copy of this LocalDateTime with the year altered.
the year to set in the result, from MIN_YEAR to MAX_YEAR
Static
fromObtains an instance of LocalDateTime from a temporal object.
Static
nowObtains the current time from the system clock in the default time-zone.
Static
ofObtains 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, minute and second, setting the nanosecond to zero.
Obtains an instance of LocalDateTime from year, month, day, hour, minute, second and nanosecond.
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, minute and second, setting the nanosecond to zero.
Obtains an instance of LocalDateTime from year, month, day, hour, minute, second and nanosecond.
Obtains an instance of LocalDateTime from a date and time.
Static
ofObtains an instance of LocalDateTime using seconds from the epoch of 1970-01-01T00:00:00Z.
Static
ofObtains an instance of LocalDateTime from an Instant and zone ID.
Static
parseObtains an instance of LocalDateTime from a text string such as 2007-12-03T10:15:30.
Optional
formatter: DateTimeFormatter
A date-time without a time-zone in the ISO-8601 calendar system, such as 2007-12-03T10:15:30.
See java.time.LocalDateTime for full documentation