Skip to main content
Version: v5.1

second

Extracts the second component from a timestamp with subsecond precision.

second(x: time) -> float

Description

The second function extracts the second component from a timestamp as a floating-point number (0-59.999…) that includes subsecond precision.

x: time

The timestamp from which to extract the second.

Examples

Extract the second from a timestamp

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

Extract only the full second component without subsecond precision

from {
  ts: 2024-06-15T14:30:45.123456,
}
full_second = ts.second().floor()
{
  ts: 2024-06-15T14:30:45.123456,
  full_second: 45,
}

See Also

year, month, day, hour, minute