Date class

A calendar date. Year / month / day.

Inheritance

Constructors

Date(int year, [int month = 1, int day = 1])
Date.fromTime(DateTime time, {Duration? tzOffset})
Extracts the Date from the given time.
factory
Date.fromTimestamp(int msSinceEpoch)
Creates a Date from an int representing milliseconds since epoch.
factory
Date.parse(String input, DateFormat format)
factory
Date.parseLoose(String input, DateFormat format)
factory
Date.parseStrict(String input, DateFormat format)
factory
Date.today([Clock? clock])
factory

Properties

day int
no setter
hashCode int
The hash code for this object.
no setteroverride
month int
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
weekday int
no setter
year int
no setter

Methods

add({int years = 0, int months = 0, int days = 0}) Date
asUtcTime() DateTime
Returns this Date as a DateTime at midnight UTC.
compareTo(Date? other) int
Compares this object to another object.
override
format(DateFormat? format) String
isAfter(Date? other) bool
isBefore(Date? other) bool
isOnOrAfter(Date other) bool
isOnOrBefore(Date other) bool
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
subtract({int years = 0, int months = 0, int days = 0}) Date
Subtracts the years, months, days from the Date. Equivalent to add with negative values.
toString() String
A string representation of this object.
override

Operators

operator <(Date? other) bool
inherited
operator <=(Date? other) bool
inherited
operator ==(Object other) bool
The equality operator.
inherited
operator >(Date? other) bool
inherited
operator >=(Date? other) bool
inherited