Time class

Represents a time of day.

This is 24h time. For example, 1:30pm is represented as 13:30.

Range is 00:00 to 23:59.

Constructors

Time(int hour, int minute)
Creates a new Time object.
Time.fromDateTime(DateTime dateTime)
Creates a new Time object from a DateTime object.
factory
Time.now()
Creates a new Time object from the current time.
factory

Properties

hashCode → int
The hash code for this object.
no setteroverride
hour ↔ int
The hour of the day.
getter/setter pair
hourStr → String
Returns hour as a two digit string, padded with a leading zero if necessary.
no setter
hourStr_12h → String
Returns hour (converted to 12h time) as a two digit string, padded with a leading zero if necessary.
no setter
minute ↔ int
The minute of the hour.
getter/setter pair
minuteStr → String
Returns minute as a two digit string, padded with a leading zero if necessary.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
timeStr → String
Returns hourStr and minuteStr separated by a colon.
no setter
timeStr_12h → String
Returns hourStr_12h and minuteStr separated by a colon.
no setter

Methods

add(Duration duration) → void
Adds duration to this Time object.
compareTo(Time other) → int
Compares this Time object to other, returning 0 if the values are equal.
difference(Time other) → Duration
Calculates the difference between this Time object and another Time object.
isAfter(Time other) → bool
Whether or not this Time object is after other.
isAtSameMomentAs(Time other) → bool
Whether or not this Time object is at the same moment as other.
isBefore(Time other) → bool
Whether or not this Time object is before other.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
subtract(Duration duration) → void
Subtracts duration from this Time object.
toDateTime() → DateTime
Returns a DateTime object which represents this Time object.
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
override