LocalTime class

A time without a time-zone, such as 8:18pm.

Implemented types
Available extensions

Constructors

LocalTime(int hour, int minute, [int second = 0, int millisecond = 0, int microsecond = 0])
Constructs a new LocalTime instance from components, like hour, minute and second.
LocalTime.from(Temporal temporal)
Constructs a new LocalTime instance from the given temporal.
factory
LocalTime.now()
Constructs a new LocalTime instance with current time in the local timezone.
factory
LocalTime.ofMicrosecondOfDay(int microsecondOfDay)
Constructs a new LocalTime instance with the given microsecondOfDay.
factory
LocalTime.parse(String formattedString)
Constructs a new LocalTime instance based on formattedString.
factory

Properties

hashCode int
The hash code for this object.
no setteroverride
hour int
The hour of the day, expressed as in a 24-hour clock [0..23].
no setter
microsecond int
The microsecond [0...999].
no setter
microsecondOfDay int
no setter
millisecond int
The millisecond [0...999].
no setter
minute int
The minute [0...59].
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
second int
The second [0...59].
no setter

Methods

adjust(ChronoField field, int newValue) LocalTime
Returns a new instance of this Temporal with the given field adjusted to newValue.
override
atDate(LocalDate date) LocalDateTime

Available on LocalTime, provided by the LocalTimeWithDate extension

Combines this LocalTime with the given date to create a new LocalDateTime.
atEndOfMonth() → T

Available on T, provided by the TemporalAdjusters extension

Returns a new instance of this Temporal at the end of the month.
atStartOfMonth() → T

Available on T, provided by the TemporalAdjusters extension

Returns a new instance of this Temporal at the start of the month.
atStartOfWeek([String? locale]) → T

Available on T, provided by the TemporalWeekFields extension

Returns a new instance of this Temporal at the start of the week.
compareTo(LocalTime other) int
Compares this object to another object.
override
copyWith({int? hour, int? minute, int? second, int? millisecond, int? microsecond}) LocalTime
Returns a new instance of this LocalTime with the given individual properties adjusted.
get(ChronoField field) int
Returns the value for the given field of this Temporal.
override
minus(int amountToSubtract, ChronoUnit unit) LocalTime
Returns a new instance of this Temporal with the given amount subtracted.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
plus(int amountToAdd, ChronoUnit unit) LocalTime
Returns a new instance of this Temporal with the given amount added.
override
toString() String
A string representation of this object.
override
until(Temporal endExclusive, ChronoUnit unit) int
Returns the difference in the given unit between this Temporal and endExclusive.
override

Operators

operator +(TemporalAmount amount) LocalTime
Returns a new instance of this Temporal with the given amount added.
override
operator -(TemporalAmount amount) LocalTime
Returns a new instance of this Temporal with the given amount subtracted.
override
operator <(LocalTime other) bool
Whether this LocalTime occurs before other.
operator <=(LocalTime other) bool
Whether this LocalTime occurs before or at the same moment as other.
operator ==(Object other) bool
The equality operator.
override
operator >(LocalTime other) bool
Whether this LocalTime occurs after other.
operator >=(LocalTime other) bool
Whether this LocalTime occurs after or at the same moment as other.

Static Properties

midnight LocalTime
The time of midnight at the start of the day, '00:00'.
final