Skip to content

second

Extracts the second component from a timestamp with subsecond precision.

second(x: time) -> float

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

The timestamp from which to extract the second.

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

Section titled “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,
}

year, month, day, hour, minute

Last updated: