Time class

A Time represents the time independent of whether it is in the UTC or local timezone.

Implemented types
Annotations
  • @immutable

Constructors

Time(int hour, [int minute = 0, int second = 0, int millisecond = 0, int microsecond = 0])
Creates a Time with the given time.
const

Properties

hashCode int
The hash code for this object.
no setteroverride
hour int
The hour.
final
inMicroseconds int
Returns this in microseconds.
no setter
inMilliseconds int
Returns this in milliseconds.
no setter
microsecond int
THe microsecond.
final
millisecond int
The millisecond.
final
minute int
The minute.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
second int
The second.
final

Methods

compareTo(Time other) int
Compares this object to another object.
override
difference(Time other) Duration
Returns the difference between this and other.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator +(Duration duration) Time
Adds the given duration to this time. A RangeError is thrown if the resultant time is less than min or greater than max.
operator -(Duration duration) Time
Subtracts the given duration from this time. A RangeError is thrown if the resultant time is less than min or greater than max.
operator <(Time other) bool
Returns true if this is before other and false otherwise.
operator <=(Time other) bool
Returns true if this is before or the same as other and false otherwise.
operator ==(Object other) bool
The equality operator.
override
operator >(Time other) bool
Returns true if this is after other and false otherwise.
operator >=(Time other) bool
Returns true if this is after or the same as other and false otherwise.

Constants

max → const Time
The end of the day (11:59:59:999:999 pm).
min → const Time
The start of the day (12 am).
noon → const Time
THe middle of the day (12 pm).