
The java.time.LocalDate class represents a date without a time-zone in the ISO-8601 calendar system, such as 2007-12-03.
Following is the declaration for java.time.LocalDate class −
public final class LocalDate
extends Object
implements Temporal, TemporalAdjuster, ChronoLocalDate, Serializable
Following are the fields for java.time.LocalDate class −
static LocalDate MAX − The maximum supported LocalDate, '+999999999-12-31'.
static LocalDate MIN − The minimum supported LocalDate, '-999999999-01-01'.
| Sr.No. | Method & Description |
|---|---|
| 1 | Temporal adjustInto(Temporal temporal)
Adjusts the specified temporal object to have the same date as this object. |
| 2 | LocalDateTime atStartOfDay()
Combines this date with the time of midnight to create a LocalDateTime at the start of this date. |
| 3 | ZonedDateTime atStartOfDay(ZoneId zone)
Returns a zoned date-time from this date at the earliest valid time according to the rules in the time-zone. |
| 4 | LocalDateTime atTime(int hour, int minute)
Combines this date with a time to create a LocalDateTime. |
| 5 | LocalDateTime atTime(int hour, int minute, int second)
Combines this date with a time to create a LocalDateTime. |
| 6 | LocalDateTime atTime(int hour, int minute, int second, int nanoOfSecond)
Combines this date with a time to create a LocalDateTime. |
| 7 | LocalDateTime atTime(LocalTime time)
Combines this date with a time to create a LocalDateTime. |
| 8 | OffsetDateTime atTime(OffsetTime time)
Combines this date with an offset time to create an OffsetDateTime. |
| 9 | int compareTo(ChronoLocalDate other)
Compares this date to another date. |
| 10 | boolean equals(Object obj)
Checks if this date is equal to another date. |
| 11 | String format(DateTimeFormatter formatter)
Formats this date using the specified formatter. |
| 12 | static LocalDate from(TemporalAccessor temporal)
Obtains an instance of LocalDate from a temporal object. |
| 13 | int get(TemporalField field)
Gets the value of the specified field from this date as an int. |
| 14 | IsoChronology getChronology()
Gets the chronology of this date, which is the ISO calendar system. |
| 15 | int getDayOfMonth()
Gets the day-of-month field. |
| 16 | DayOfWeek getDayOfWeek()
Gets the day-of-week field, which is an enum DayOfWeek. |
| 17 | int getDayOfYear()
Gets the day-of-year field. |
| 18 | Era getEra()
Gets the era applicable at this date. |
| 19 | long getLong(TemporalField field)
Gets the value of the specified field from this date as a long. |
| 20 | Month getMonth()
Gets the month-of-year field using the Month enum. |
| 21 | int getMonthValue()
Gets the month-of-year field from 1 to 12. |
| 22 | int getYear()
Gets the year field. |
| 23 | int hashCode()
A hash code for this date. |
| 24 | boolean isAfter(ChronoLocalDate other)
Checks if this date is after the specified date. |
| 25 | boolean isBefore(ChronoLocalDate other)
Checks if this date is before the specified date. |
| 26 | boolean isEqual(ChronoLocalDate other)
Checks if this date is equal to the specified date. |
| 27 | boolean isLeapYear()
Checks if the year is a leap year, according to the ISO proleptic calendar system rules. |
| 28 | boolean isSupported(TemporalField field)
Checks if the specified field is supported. |
| 29 | boolean isSupported(TemporalUnit unit)
Checks if the specified unit is supported. |
| 30 | int lengthOfMonth()
Returns the length of the month represented by this date. |
| 31 | int lengthOfYear()
Returns the length of the year represented by this date. |
| 32 | LocalDate minus(long amountToSubtract, TemporalUnit unit)
Returns a copy of this date with the specified amount subtracted. |
| 33 | LocalDate minus(TemporalAmount amountToSubtract)
Returns a copy of this date with the specified amount subtracted. |
| 34 | LocalDate minusDays(long daysToSubtract)
Returns a copy of this LocalDate with the specified number of days subtracted. |
| 35 | LocalDate minusMonths(long monthsToSubtract)
Returns a copy of this LocalDate with the specified number of months subtracted. |
| 36 | LocalDate minusWeeks(long weeksToSubtract)
Returns a copy of this LocalDate with the specified number of weeks subtracted. |
| 37 | LocalDate minusYears(long yearsToSubtract)
Returns a copy of this LocalDate with the specified number of years subtracted. |
| 38 | static LocalDate now()
Obtains the current date from the system clock in the default time-zone. |
| 39 | static LocalDate now(Clock clock)
Obtains the current date from the specified clock. |
| 40 | static LocalDate now(ZoneId zone)
Obtains the current date from the system clock in the specified time-zone. |
| 41 | static LocalDate of(int year, int month, int dayOfMonth)
Obtains an instance of LocalDate from a year, month and day. |
| 42 | static LocalDate of(int year, Month month, int dayOfMonth)
Obtains an instance of LocalDate from a year, month and day. |
| 43 | static LocalDate ofEpochDay(long epochDay)
Obtains an instance of LocalDate from the epoch day count. |
| 44 | static LocalDate ofYearDay(int year, int dayOfYear)
Obtains an instance of LocalDate from a year and day-of-year. |
| 45 | static LocalDate parse(CharSequence text)
Obtains an instance of LocalDate from a text string such as 2007-12-03. |
| 46 | static LocalDate parse(CharSequence text, DateTimeFormatter formatter)
Obtains an instance of LocalDate from a text string using a specific formatter. |
| 47 | LocalDate plus(long amountToAdd, TemporalUnit unit)
Returns a copy of this date with the specified amount added. |
| 48 | LocalDate plus(TemporalAmount amountToAdd)
Returns a copy of this date with the specified amount added. |
| 49 | LocalDate plusDays(long daysToAdd)
Returns a copy of this LocalDate with the specified number of days added. |
| 50 | LocalDate plusMonths(long monthsToAdd)
Returns a copy of this LocalDate with the specified number of months added. |
| 51 | LocalDate plusWeeks(long weeksToAdd)
Returns a copy of this LocalDate with the specified number of weeks added. |
| 52 | LocalDate plusYears(long yearsToAdd)
Returns a copy of this LocalDate with the specified number of years added. |
| 53 | <R> R query(TemporalQuery<R> query)
Queries this date using the specified query. |
| 54 | ValueRange range(TemporalField field)
Gets the range of valid values for the specified field. |
| 55 | long toEpochDay()
Converts this date to the Epoch Day. |
| 56 | String toString()
Outputs this date as a String, such as 2007-12-03. |
| 57 | Period until(ChronoLocalDate endDateExclusive)
Calculates the period between this date and another date as a Period. |
| 58 | long until(Temporal endExclusive, TemporalUnit unit)
Calculates the amount of time until another date in terms of the specified unit. |
| 59 | LocalDate with(TemporalAdjuster adjuster)
Returns an adjusted copy of this date. |
| 60 | LocalDate with(TemporalField field, long newValue)
Returns a copy of this date with the specified field set to a new value. |
| 61 | LocalDate withDayOfMonth(int dayOfMonth)
Returns a copy of this LocalDate with the day-of-month altered. |
| 62 | LocalDate withDayOfYear(int dayOfYear)
Returns a copy of this LocalDate with the day-of-year altered. |
| 63 | LocalDate withMonth(int month)
Returns a copy of this LocalDate with the month-of-year altered. |
| 64 | LocalDate withYear(int year)
Returns a copy of this LocalDate with the year altered. |
This class inherits methods from the following classes −