time property

Expression<String> time

Formats this datetime in the format hour:minute:second.

Even if the date time stored was in a local timezone, this format returns the formatted value in UTC. For example, if your local timezone has the UTC offset +02:00 and you're inserting a (local) DateTime value at 12:34, running the hour getter on this value would return 10, since the datetime is at 10:34 in UTC.

To make this function return a value formatted as a local timestamp, you can use modify with a DateTimeModifier.localTime before invoking it, e.g.

 Variable(DateTime.now()).modify(DateTimeModifier.localTime()).hour

Implementation

Expression<String> get time {
  return _DependingOnDateTimeExpression.generate((datesAsText) {
    return FunctionCallExpression('TIME',
        [this, if (!datesAsText) const DateTimeModifier._unixEpoch()]);
  });
}