LocalDate class Local times
A date with no timezone.
- Implemented types
- Annotations
-
- @immutable
Constructors
- LocalDate([int year = 0, int month = 1, int day = 1])
-
Constructs a
LocalDatefrom individual parts.const - LocalDate.fromDateTime(DateTime dateTime)
-
Constructs a
LocalDatefrom a standard Dart DateTime. - LocalDate.now()
-
Constructs a
LocalDatewith the current date and time in defaultZoneId.factory - LocalDate.parse(String date)
-
Parses an ISO 8601 date string.
factory
Properties
- day → int
-
The day starting at 1.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setteroverride
- inLeapYear → bool
-
Determines if this date falls in a leap year.
no setterinherited
- isLeapYear → bool
-
True if this date falls in a leap year.
no setter
- month → int
-
The month from 1 to 12.
no setterinherited
- ordinalDay → int
-
The number of days since the beginning of the year.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- weekday → Weekday
-
The day of the week.
no setterinherited
- year → int
-
The year.
no setterinherited
Methods
-
atOffset(
[ZoneOffset? offset]) → OffsetDateTime - Converts this to an OffsetDateTime with the given offset.
-
compareTo(
LocalDate other) → int -
Compares this object to another object.
override
-
format(
DateFormat format) → String -
Formats this object using the given format.
inherited
-
inTimezone(
[String? zoneId]) → ZonedDateTime - Converts this to a ZonedDateTime.
-
minusPeriod(
Period p) → LocalDate - Subtracts Period of time.
-
minusTimespan(
Timespan t) → LocalDate - Subtracts a Timespan.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
periodUntil(
HasDate other) → Period - Finds the Period between this date and another.
-
plusPeriod(
Period p) → LocalDate - Adds Period of time.
-
plusTimespan(
Timespan t) → LocalDate - Adds a Timespan.
-
quantize(
RelativeTime amount) → LocalDate -
Rounds this to a value divisible by
amount. -
replace(
{int? year, int? month, int? day}) → LocalDate - Returns a new date with one or more fields replaced.
-
timespanUntil(
LocalDate other) → Timespan - Returns the Timespan between this and another date. The result will always be an integer number of days.
-
toDateTime(
) → DateTime - Converts this to a DateTime in the local time zone.
-
toInstant(
) → Instant - Converts this to an Instant in UTC.
-
toLocal(
) → LocalDateTime - Converts this to a LocalDateTime.
-
toString(
) → String - Returns the date in ISO 8601 format.
Operators
-
operator +(
RelativeTime amount) → LocalDate -
Adds a
TimespanorPeriod. -
operator -(
RelativeTime amount) → LocalDate -
Subtracts a
TimespanorPeriod. -
operator <(
LocalDate other) → bool - Less than operator.
-
operator <=(
LocalDate other) → bool - Less than or equals operator.
-
operator ==(
Object other) → bool -
The equality operator.
override
-
operator >(
LocalDate other) → bool - Greater than operator.
-
operator >=(
LocalDate other) → bool - Greater than or equals operator.