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
Returns a hash code based on the microsecond value of this time.
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 time to other.
override
difference(Time other) → Duration
Returns the difference between this and other.
from({DateTime? dateTime, int? seconds}) → Time
Returns Time from DateTime
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
now() → Time
Returns Time from DateTime.now()
toString() → String
Returns this time formatted as HH:mm:ss.ffffff.
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
Returns true if other represents the same time of day.
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.

Static Methods

parse(String formattedString) → Time
Constructs a new Time instance based on formattedString.
tryParse(String formattedString) → Time?
Constructs a new Time instance based on formattedString.

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).