LocalDate class

A date without a time-zone, such as July 20, 1969.

Implemented types
Available extensions

Constructors

LocalDate(int year, [int month = 1, int dayOfMonth = 1])
Constructs a new LocalDate instance from components, like year, month and day.
LocalDate.from(Temporal temporal)
Constructs a new LocalDate instance from the given temporal.
factory
LocalDate.now()
Constructs a new LocalDate instance with current date in the local timezone.
factory
LocalDate.ofEpochDay(int epochDay)
Constructs a new LocalDate instance with the given epochDay count.
factory
LocalDate.parse(String formattedString)
Constructs a new LocalDate instance based on formattedString.
factory

Properties

dayOfMonth int
The day of the month [1..31].
no setter
dayOfWeek DayOfWeek
The day of the week [monday..sunday].
no setter
epochDay int
The epoch-day. Count of days since epoch (1970-01-01).
no setter
hashCode int
The hash code for this object.
no setteroverride
isLeapYear bool
Returns true if year is a leap year.
no setter
month int
The month [1..12].
no setter
prolepticMonth int
The proleptic month. Count of months since year 0.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
year int
The year.
no setter

Methods

adjust(ChronoField field, int newValue) LocalDate
Returns a new instance of this Temporal with the given field adjusted to newValue.
override
atEndOfMonth() → T

Available on T, provided by the TemporalAdjusters extension

Returns a new instance of this Temporal at the end of the month.
atStartOfDay() LocalDateTime

Available on LocalDate, provided by the LocalDateWithTime extension

Combines this LocalDate with the time of midnight to create a new LocalDateTime at the start of this date.
atStartOfMonth() → T

Available on T, provided by the TemporalAdjusters extension

Returns a new instance of this Temporal at the start of the month.
atStartOfWeek([String? locale]) → T

Available on T, provided by the TemporalWeekFields extension

Returns a new instance of this Temporal at the start of the week.
atTime(LocalTime time) LocalDateTime

Available on LocalDate, provided by the LocalDateWithTime extension

Combines this LocalDate with the given time to create a new LocalDateTime.
compareTo(LocalDate other) int
Compares this object to another object.
override
copyWith({int? year, int? month, int? dayOfMonth}) LocalDate
Returns a new instance of this LocalDate with the given individual properties adjusted.
format(DateFormat format) String
Returns a string representing this LocalDate, formatted according to the given format.
get(ChronoField field) int
Returns the value for the given field of this Temporal.
override
minus(int amountToSubtract, ChronoUnit unit) LocalDate
Returns a new instance of this Temporal with the given amount subtracted.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
plus(int amountToAdd, ChronoUnit unit) LocalDate
Returns a new instance of this Temporal with the given amount added.
override
toString() String
A string representation of this object.
override
until(Temporal endExclusive, ChronoUnit unit) int
Returns the difference in the given unit between this Temporal and endExclusive.
override

Operators

operator +(TemporalAmount amount) LocalDate
Returns a new instance of this Temporal with the given amount added.
override
operator -(TemporalAmount amount) LocalDate
Returns a new instance of this Temporal with the given amount subtracted.
override
operator <(LocalDate other) bool
Whether this LocalDate occurs before other.
operator <=(LocalDate other) bool
Whether this LocalDate occurs before or at the same moment as other.
operator ==(Object other) bool
The equality operator.
override
operator >(LocalDate other) bool
Whether this LocalDate occurs after other.
operator >=(LocalDate other) bool
Whether this LocalDate occurs after or at the same moment as other.

Static Properties

epoch LocalDate
The date at the start of the epoch year, '1970-01-01'.
final