Day class

Available Extensions

Constructors

Day()
Constructs a new Day instance with current date and time in the local time zone.
Day.fromDateTime(DateTime time)
Constructs a new Day from a DateTime instance.
Day.fromDayInstance(Day day)
Constructs a new Day from a Day.
Day.fromString(String time)
Constructs a new Day based on an ISO 8601 formatted string.
Day.fromUnix(int time)
Constructs a new Day from a unix milliseconds.

Properties

hashCode int
The hash code for this object.
no setteroverride
isUtc bool
True if this Day is set to UTC time.
no setter
localLocale Map<String, dynamic>?
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

Methods

add(int val, String unit) → dynamic
Add val by unit. Supports shorthand.
clone() Day
Clone this Day.
compareTo(Day day) int
Compares this day to other, returning zero if the values are equal.
date([int? date]) → dynamic
Gets or sets the date of this Day.
dec(int val, String unit) → dynamic
Alias of subtract.
diff(Day day, [String unit = Unit.ms]) int
Returns a number with the difference between two days by specified unit.
finished() → void
Alias of _updateTime.
format([String? format]) String
Format the Day's displaying.
get(String unit) int?
Gets int value by unit. Supports shorthand. Returns null if the unit is not found.
getLocale() Map<String, dynamic>
hour([int? hour]) → dynamic
Gets or sets the hour of this Day.
inc(int val, String unit) → dynamic
Alias of add.
isAfter(Day day) bool
Returns true if this day occurs after other day.
isBefore(Day day) bool
Returns true if this day occurs before other day.
isValid() bool
millisecond([int? millisecond]) → dynamic
Gets or sets the millisecond of this Day.
minute([int? minute]) → dynamic
Gets or sets the minute of this Day.
month([int? month]) → dynamic
Gets or sets the month of this Day.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
second([int? second]) → dynamic
Gets or sets the second of this Day.
set(String unit, int val) → void
Sets val by unit. Supports shorthand. It will not do anything if the unit is not found.
setDate(int date) → void
Sets the date, it won't update the internal _time.
setHour(int hour) → void
Sets the hour, it won't update the internal _time.
setMillisecond(int millisecond) → void
Sets the millisecond, it won't update the internal _time.
setMinute(int minute) → void
Sets the minute, it won't update the internal _time.
setMonth(int month) → void
Sets the month, it won't update the internal _time.
setSecond(int second) → void
Sets the second, it won't update the internal _time.
setValue(String key, int val) → void
Sets by key and val, it won't update the internal _time.
setYear(int year) → void
Sets the year, it won't update the internal _time.
subtract(int val, String unit) → dynamic
Subtract val by unit. Supports shorthand.
toDateTime() DateTime
toIso8601String() String
Returns an ISO-8601 full-precision extended format representation of this Day.
toLocal() Day
Convert this Day to local.
toString() String
A string representation of this object.
override
toUtc() Day
Convert this Day to UTC.
useLocale(Map<String, dynamic> localLocale) Day
weekday() int
Gets the weekday of this Day.
year([int? year]) → dynamic
Gets or sets the year of this Day.

Operators

operator ==(Object day) bool
The equality operator.
override

Static Properties

locale Map<String, dynamic>
getter/setter pair