Java java.time LocalDateTime fields, constructors, methods, implement or subclass

Example usage for Java java.time LocalDateTime fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for java.time LocalDateTime.

The text is from its open source code.

Field

LocalDateTimeMIN
The minimum supported LocalDateTime , '-999999999-01-01T00:00:00'.
LocalDateTimeMAX
The maximum supported LocalDateTime , '+999999999-12-31T23:59:59.999999999'.

Method

TemporaladjustInto(Temporal temporal)
Adjusts the specified temporal object to have the same date and time as this object.
OffsetDateTimeatOffset(ZoneOffset offset)
Combines this date-time with an offset to create an OffsetDateTime .
ZonedDateTimeatZone(ZoneId zone)
Combines this date-time with a time-zone to create a ZonedDateTime .
intcompareTo(ChronoLocalDateTime other)
Compares this date-time to another date-time.
booleanequals(Object obj)
Checks if this date-time is equal to another date-time.
Stringformat(DateTimeFormatter formatter)
Formats this date-time using the specified formatter.
LocalDateTimefrom(TemporalAccessor temporal)
Obtains an instance of LocalDateTime from a temporal object.
intget(TemporalField field)
Gets the value of the specified field from this date-time as an int .
intgetDayOfMonth()
Gets the day-of-month field.
DayOfWeekgetDayOfWeek()
Gets the day-of-week field, which is an enum DayOfWeek .
intgetDayOfYear()
Gets the day-of-year field.
intgetHour()
Gets the hour-of-day field.
longgetLong(TemporalField field)
Gets the value of the specified field from this date-time as a long .
intgetMinute()
Gets the minute-of-hour field.
MonthgetMonth()
Gets the month-of-year field using the Month enum.
intgetMonthValue()
Gets the month-of-year field from 1 to 12.
intgetNano()
Gets the nano-of-second field.
intgetSecond()
Gets the second-of-minute field.
intgetYear()
Gets the year field.
inthashCode()
A hash code for this date-time.
booleanisAfter(ChronoLocalDateTime other)
Checks if this date-time is after the specified date-time.
booleanisBefore(ChronoLocalDateTime other)
Checks if this date-time is before the specified date-time.
booleanisEqual(ChronoLocalDateTime other)
Checks if this date-time is equal to the specified date-time.
booleanisSupported(TemporalField field)
Checks if the specified field is supported.
booleanisSupported(TemporalUnit unit)
Checks if the specified unit is supported.
LocalDateTimeminus(TemporalAmount amountToSubtract)
Returns a copy of this date-time with the specified amount subtracted.
LocalDateTimeminus(long amountToSubtract, TemporalUnit unit)
Returns a copy of this date-time with the specified amount subtracted.
LocalDateTimeminusDays(long days)
Returns a copy of this LocalDateTime with the specified number of days subtracted.
LocalDateTimeminusHours(long hours)
Returns a copy of this LocalDateTime with the specified number of hours subtracted.
LocalDateTimeminusMinutes(long minutes)
Returns a copy of this LocalDateTime with the specified number of minutes subtracted.
LocalDateTimeminusMonths(long months)
Returns a copy of this LocalDateTime with the specified number of months subtracted.
LocalDateTimeminusNanos(long nanos)
Returns a copy of this LocalDateTime with the specified number of nanoseconds subtracted.
LocalDateTimeminusSeconds(long seconds)
Returns a copy of this LocalDateTime with the specified number of seconds subtracted.
LocalDateTimeminusYears(long years)
Returns a copy of this LocalDateTime with the specified number of years subtracted.
LocalDateTimenow()
Obtains the current date-time from the system clock in the default time-zone.
LocalDateTimenow(ZoneId zone)
Obtains the current date-time from the system clock in the specified time-zone.
LocalDateTimenow(Clock clock)
Obtains the current date-time from the specified clock.
LocalDateTimeof(int year, Month month, int dayOfMonth, int hour, int minute)
Obtains an instance of LocalDateTime from year, month, day, hour and minute, setting the second and nanosecond to zero.
LocalDateTimeof(int year, int month, int dayOfMonth, int hour, int minute)
Obtains an instance of LocalDateTime from year, month, day, hour and minute, setting the second and nanosecond to zero.
LocalDateTimeof(LocalDate date, LocalTime time)
Obtains an instance of LocalDateTime from a date and time.
LocalDateTimeof(int year, Month month, int dayOfMonth, int hour, int minute, int second)
Obtains an instance of LocalDateTime from year, month, day, hour, minute and second, setting the nanosecond to zero.
LocalDateTimeof(int year, int month, int dayOfMonth, int hour, int minute, int second)
Obtains an instance of LocalDateTime from year, month, day, hour, minute and second, setting the nanosecond to zero.
LocalDateTimeof(int year, Month month, int dayOfMonth, int hour, int minute, int second, int nanoOfSecond)
Obtains an instance of LocalDateTime from year, month, day, hour, minute, second and nanosecond.
LocalDateTimeof(int year, int month, int dayOfMonth, int hour, int minute, int second, int nanoOfSecond)
Obtains an instance of LocalDateTime from year, month, day, hour, minute, second and nanosecond.
LocalDateTimeofEpochSecond(long epochSecond, int nanoOfSecond, ZoneOffset offset)
Obtains an instance of LocalDateTime using seconds from the epoch of 1970-01-01T00:00:00Z.
LocalDateTimeofInstant(Instant instant, ZoneId zone)
Obtains an instance of LocalDateTime from an Instant and zone ID.
LocalDateTimeparse(CharSequence text)
Obtains an instance of LocalDateTime from a text string such as 2007-12-03T10:15:30 .
LocalDateTimeparse(CharSequence text, DateTimeFormatter formatter)
Obtains an instance of LocalDateTime from a text string using a specific formatter.
LocalDateTimeplus(long amountToAdd, TemporalUnit unit)
Returns a copy of this date-time with the specified amount added.
LocalDateTimeplus(TemporalAmount amountToAdd)
Returns a copy of this date-time with the specified amount added.
LocalDateTimeplusDays(long days)
Returns a copy of this LocalDateTime with the specified number of days added.
LocalDateTimeplusHours(long hours)
Returns a copy of this LocalDateTime with the specified number of hours added.
LocalDateTimeplusMinutes(long minutes)
Returns a copy of this LocalDateTime with the specified number of minutes added.
LocalDateTimeplusMonths(long months)
Returns a copy of this LocalDateTime with the specified number of months added.
LocalDateTimeplusNanos(long nanos)
Returns a copy of this LocalDateTime with the specified number of nanoseconds added.
LocalDateTimeplusSeconds(long seconds)
Returns a copy of this LocalDateTime with the specified number of seconds added.
LocalDateTimeplusWeeks(long weeks)
Returns a copy of this LocalDateTime with the specified number of weeks added.
LocalDateTimeplusYears(long years)
Returns a copy of this LocalDateTime with the specified number of years added.
Rquery(TemporalQuery query)
Queries this date-time using the specified query.
ValueRangerange(TemporalField field)
Gets the range of valid values for the specified field.
longtoEpochSecond(ZoneOffset offset)
Converts this date-time to the number of seconds from the epoch of 1970-01-01T00:00:00Z.
InstanttoInstant(ZoneOffset offset)
Converts this date-time to an Instant .
LocalDatetoLocalDate()
Gets the LocalDate part of this date-time.
LocalTimetoLocalTime()
Gets the LocalTime part of this date-time.
StringtoString()
Outputs this date-time as a String , such as 2007-12-03T10:15:30 .
LocalDateTimetruncatedTo(TemporalUnit unit)
Returns a copy of this LocalDateTime with the time truncated.
longuntil(Temporal endExclusive, TemporalUnit unit)
Calculates the amount of time until another date-time in terms of the specified unit.
LocalDateTimewith(TemporalAdjuster adjuster)
Returns an adjusted copy of this date-time.
LocalDateTimewith(LocalDate newDate, LocalTime newTime)
Returns a copy of this date-time with the new date and time, checking to see if a new object is in fact required.
LocalDateTimewith(TemporalField field, long newValue)
Returns a copy of this date-time with the specified field set to a new value.
LocalDateTimewithDayOfMonth(int dayOfMonth)
Returns a copy of this LocalDateTime with the day-of-month altered.
LocalDateTimewithDayOfYear(int dayOfYear)
Returns a copy of this LocalDateTime with the day-of-year altered.
LocalDateTimewithHour(int hour)
Returns a copy of this LocalDateTime with the hour-of-day altered.
LocalDateTimewithMinute(int minute)
Returns a copy of this LocalDateTime with the minute-of-hour altered.
LocalDateTimewithMonth(int month)
Returns a copy of this LocalDateTime with the month-of-year altered.
LocalDateTimewithNano(int nanoOfSecond)
Returns a copy of this LocalDateTime with the nano-of-second altered.
LocalDateTimewithSecond(int second)
Returns a copy of this LocalDateTime with the second-of-minute altered.
LocalDateTimewithYear(int year)
Returns a copy of this LocalDateTime with the year altered.