Skip to main content
Version: v5.1

hour

Extracts the hour component from a timestamp.

hour(x: time) -> int

Description

The hour function extracts the hour component from a timestamp as an integer (0-23).

x: time

The timestamp from which to extract the hour.

Examples

Extract the hour from a timestamp

from {
  ts: 2024-06-15T14:30:45.123456,
}
hour = ts.hour()
{
  ts: 2024-06-15T14:30:45.123456,
  hour: 14,
}

See Also

year, month, day, minute, second