Skip to content

TimeOfDay

A time on a day in 24-hour format. Used in a ScheduledTrigger.

Follows the conventions in the DateTime class, but only uses the Time part in a 24 hour time format.

Annotations

Constructors

TimeOfDay.fromDateTime

TimeOfDay.fromDateTime(
  1. DateTime time
)

Creates a TimeOfDay based on the given time.

TimeOfDay.fromJson

TimeOfDay.fromJson(
  1. Map<String, dynamic> json
)

TimeOfDay

const TimeOfDay({
  1. int hour = 0,
  2. int minute = 0,
  3. int second = 0,
})

Constructs an instance of TimeOfDay.

TimeOfDay.now

TimeOfDay.now()

Constructs a TimeOfDay instance with current time in the local time zone.

Properties

hour

int hour
final

The hour in 24 hour format (0-23).

minute

int minute
final

The minute 0-59.

second

int second
final

The second 0-59.

Methods

difference

Duration difference(
  1. TimeOfDay other
)

Returns a Duration with the difference when subtracting other from this time.

The returned Duration will be negative if other occurs after this time.

isAfter

bool isAfter(
  1. TimeOfDay other
)

Returns true if this time occurs after other.

The comparison is independent of whether the time is in UTC or in the local time zone.

isBefore

bool isBefore(
  1. TimeOfDay other
)

Returns true if this time occurs before other.

The comparison is independent of whether the time is in UTC or in the local time zone.

toJson

Map<String, dynamic> toJson()

toString

String toString()
override

Output as ISO 8601 extended time format with seconds accuracy, omitting the 24th hour and 60th leap second. E.g., "09:30:00".