Date class

Implemented types


Date(int year, [int month = 1, int day = 1])
Creates a date only. The year month day.
Date.fromDateTime(DateTime dateTime)
Creates a time of day based on the given time.
Date.fromMicrosecondsSinceEpoch(int microsecondsSinceEpoch, {bool isUtc = false})
Date.fromMillisecondsSinceEpoch(int millisecondsSinceEpoch, {bool isUtc = false})
Creates a day date based on the current time.
Creates a tomorrow date based on the current time.
Date.withFields({required int year, int month = 1, int day = 1})
Creates a yesterday date based on the current time.


day int
no setter
firstDayOfMonth Date
no setter
firstDayOfWeek Date
no setter
formatApiDay String
no setter
formatDay String
no setter
formatFirstDay String
MMM dd
no setter
formatFullDay String
EEE MMM dd, yyyy
no setter
formatMonth String
MMMM yyyy
no setter
formatMonthOnly String
no setter
hashCode int
The hash code for this object.
no setteroverride
isFirstDayOfMonth bool
no setter
isFuture bool
is after now
no setter
isLastDayOfMonth bool
no setter
isPast bool
is before now
no setter
isToday bool
is equal to the same day
no setter
isTomorrow bool
is equal to the next day
no setter
isYesterday bool
is equal to the last day
no setter
lastDayOfMonth Date
The last day of a given month
no setter
microsecondsSinceEpoch int
The number of microseconds since the "Unix epoch" 1970-01-01T00:00:00Z (UTC).
no setter
millisecondsSinceEpoch int
no setter
month int
no setter
nextMonth Date
The previousMonth
no setter
previousMonth Date
The previousMonth
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
timeZoneName String
The time zone name.
no setter
timeZoneOffset Duration
The time zone offset, which is the difference between local time and UTC.
no setter
weekday int
The day of the week monday..sunday.
no setter
year int
no setter


add(dynamic other) Date
Add 2 dates
compareTo(Date other) int
Compares this object to another object.
copyWith({int? year, int? month, int? day}) Date
Returns a new TimeOfDay with the hour and/or minute replaced.
difference(dynamic other) Duration
Get difference duration between 2 dates
equals(Date other) bool
Whether or not two times are on the same day. === isSameAs(other)
format([String? dateFormat]) String
Returns the localized string representation of this time of day.
formatWithDateFormat([DateFormat? dateFormat]) String
isAfter(Date other) bool
isBefore(Date other) bool
isEqualOrAfter(Date other) bool
isEqualOrBefore(Date other) bool
isSameAs(Date other) bool
Whether or not two times are on the same day.
isSameMonth(Date other) bool
Whether or not two times are on the same month.
isSameWeek(Date other) bool
Whether or not two times are on the same week.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
subtract(dynamic other) Date
subtract 2 dates
toDateTime([TimeOfDay? time]) DateTime
toString() String
A string representation of this object.


operator +(dynamic other) Date
operator -(dynamic other) Date
operator <(Date other) bool
operator <=(Date other) bool
operator ==(Object other) bool
The equality operator.
operator >(Date other) bool
operator >=(Date other) bool

Static Properties

defaultDateFormat String
getter/setter pair

Static Methods

daysInMonth(Date monthDate) List<Date>
The list of days in a given month
daysInRange(Date start, Date end) Iterable<Date>
getFirstDayOfMonth(Date date) Date
getLastDayOfMonth(Date date) Date
getLastDayOfWeek(Date day) Date
getNextMonth(Date m) Date
The nextMonth
getPreviousMonth(Date m) Date
The previousMonth
nextWeek(Date w) Date
The nextWeek
parse(String formattedString, {String? dateFormat}) Date
previousWeek(Date w) Date
The previousWeek
tryParse(String formattedString) Date?
Constructs a new DateTime instance based on formattedString.


maxDaysPerMonth → const int
monthsPerYear → const int