toTzTimeOfDayString method

String toTzTimeOfDayString(
  1. bool inUtc
)

Converts the time of day of this date-time to an HH:mm:ss string in either local or UTC time zone.

The result carries no time zone marker - state the zone with timeZoneLabel where the value is displayed.

Implementation

String toTzTimeOfDayString(bool inUtc) {
  final time = inUtc ? toUtc() : toLocal();
  return [
    time.hour,
    time.minute,
    time.second,
  ].map((part) => part.toString().padLeft(2, '0')).join(':');
}