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

> SELECT from_unixtime(0, 'yyyy-MM-dd HH:mm:ss');
 1969-12-31 16:00:00
> SELECT from_unixtime(0);
 1969-12-31 16:00:00