LocalDate

public abstract class LocalDate extends Object
implements Parcelable Comparable<LocalDate>

Represents a local date with year, month, and day.

This class is based on the LocalDate class (available on SDK 26 and higher).

Inherited Constant Summary

Public Constructor Summary

Public Method Summary

int
compareTo(LocalDate dateToCompare)
abstract int
getDay()
Returns the day field.
abstract int
getMonth()
Returns the month field.
abstract int
getYear()
Returns the year field.
static LocalDate
newInstance(int year, int month, int day)
Returns a LocalDate instance given the year, month, and day.
final String
toString()
Outputs this date as a String in YYYY-MM-DD format, such as 2007-12-31.

Inherited Method Summary

Public Constructors

public LocalDate ()

Public Methods

public int compareTo (LocalDate dateToCompare)

Parameters
dateToCompare

public abstract int getDay ()

Returns the day field.

public abstract int getMonth ()

Returns the month field.

public abstract int getYear ()

Returns the year field.

public static LocalDate newInstance (int year, int month, int day)

Returns a LocalDate instance given the year, month, and day.

Parameters
year
month
day
Throws
IllegalArgumentException If parameters are not within range: 1 <= month <= 12, 1 <= day <= 31, or if the day is not valid for the given month and year.

public final String toString ()

Outputs this date as a String in YYYY-MM-DD format, such as 2007-12-31.

Returns
  • A string representation of this date.