Skip to main content
Scalar function
Returns NULL if the value or granularity is NULL. Invalid granularity values normally return NULL, including in format columns, but some constant STRING representations can raise an error.

Syntax

Scalar

Arguments

Returns

  • Type: TIMESTAMP
  • NULL behavior: Returns NULL if the value or granularity is NULL. Invalid granularity values normally return NULL, including in format columns, but some constant STRING representations can raise an error.

Properties

Usage notes

  • Unit matching accepts Spark aliases such as YY/YYYY, MM/MON, DD, plus MICROSECOND/MILLISECOND and standard granularities.
  • Truncation uses the timestamp’s stored clock values and preserves its time-zone label.

Examples

Basic example

Truncate to the start of an hour

Limitations

  • Truncation uses the stored UTC clock time and preserves the input’s time-zone label. Day, month, and year boundaries therefore follow UTC rather than the named time zone’s local clock.
Last modified on October 15, 2026