Del via


from_unixtime function

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime

Returns unixTime in fmt.

Syntax

from_unixtime(unixTime [, fmt])

Arguments

  • unixTime: A BIGINT expression representing seconds elapsed since 1969-12-31 at 16:00:00.
  • fmt: An optional STRING expression with a valid format.

Returns

A STRING.

See Datetime patterns for valid formats. The ‘yyyy-MM-dd HH:mm:ss’ pattern is used if omitted.

Examples

> SET TIMEZONE 'UTC';
> SELECT from_unixtime(0, 'yyyy-MM-dd HH:mm:ss');
 1970-01-01 00:00:00
> SELECT from_unixtime(0);
 1970-01-01 00:00:00