LocalTime class Local times

A time of day without a time zone.

Internally this stores the time in nanosecondsSinceMidnight, which means it can represent any time down to the nanosecond.

Implemented types
Annotations
  • @immutable

Constructors

LocalTime([int hour = 0, int minute = 0, int second = 0, int nanosecond = 0])
Constructs a new LocalTime.
const
LocalTime.fromDateTime(DateTime dateTime)
Constructs a LocalTime from a standard Dart DateTime.
LocalTime.now()
Constructs a LocalTime with the current time in defaultZoneId.
factory
LocalTime.parse(String time)
Parses an ISO 8601 time string.
factory

Properties

hashCode → int
The hash code for this object.
no setteroverride
hour → int
The hour from 0 to 23.
no setteroverride
minute → int
The minute from 0 to 59.
no setteroverride
nanosecond → int
The nanoseconds from 0 to 999,999,999.
no setteroverride
nanosecondsSinceMidnight → int
The time in nanoseconds relative to midnight.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
second → int
The second from 0 to 59.
no setteroverride

Methods

compareTo(LocalTime other) → int
Compares this to another LocalTime.
override
format(DateFormat format) → String
Formats object using the given format.
minusTimespan(Timespan span) → LocalTime
Subtracts a Timespan. If span covers more than one day, the result will wrap.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
plusTimespan(Timespan span) → LocalTime
Adds a Timespan. If span covers more than one day, the result will wrap.
quantize(Timespan amount) → LocalTime
Rounds this to a value divisible by amount.
replace({int? hour, int? minute, int? second, int? nanosecond}) → LocalTime
Returns a new time with one or more fields replaced.
timespanUntil(LocalTime other) → Timespan
Finds the Timespan between two times. The result will be negative if other is earlier than this.
toString() → String
Returns the time in ISO 8601 format.
override

Operators

operator +(Timespan span) → LocalTime
Adds a Timespan. If span covers more than one day, the result will wrap.
operator -(Timespan span) → LocalTime
Subtracts a Timespan. If span covers more than one day, the result will wrap.
operator <(LocalTime other) → bool
Less than operator.
operator <=(LocalTime other) → bool
Less than or equals operator.
operator ==(Object other) → bool
The equality operator.
override
operator >(LocalTime other) → bool
Greater than operator.
operator >=(LocalTime other) → bool
Greater than or equals operator.

Constants

maximum → const LocalTime
The latest possible time.
minimum → const LocalTime
The earliest possible time.