fromUnixEpoch static method

Expression<DateTime> fromUnixEpoch(
  1. Expression<int> unixEpoch
)

Converts a numeric expression unixEpoch into a date time by interpreting it as the amount of seconds since 1970-01-01 00:00:00 UTC.

Note that the returned value is in UTC if date times are stored as text. If they're stored as unix timestamps, this function is a no-op and the returned value is interpreted as a local date time (like all datetime values in that mode).

Implementation

static Expression<DateTime> fromUnixEpoch(Expression<int> unixEpoch) {
  return _DependingOnDateTimeExpression(
    forTimestamps: unixEpoch.dartCast(),
    forIsoString: FunctionCallExpression(
        'datetime', [unixEpoch, const Constant('unixepoch')]),
  );
}