Format a timestamp as a date and time

Syntax

FORMAT_TIME(…string-expr…, …num-expr…)

Typing

STRING -> num -> STRING

Description

FORMAT_TIME turns a timestamp (second operand) into a string formatted according to a given template (first operand).

The template, which need not be a literal string, can contain special character sequences that will be replaced with date and time elements from the timestamp.

The special sequences and what they stand for:

Examples

expression evaluates to
FORMAT_TIME("Sunday was day #%u", 1645354800) "Sunday was day #0"
FORMAT_TIME("%Y-%m-%dT%H:%M:%S", 1645354800) "2022-02-20T12:00:00.00"

See Also

Format a date