Skip to main content

parse_datetime_ns

Function parse_datetime_ns 

Source
pub fn parse_datetime_ns(s: &str) -> Result<u64, FilterError>
Expand description

Parse an RFC 3339 datetime string or a Unix epoch integer (in seconds) to nanoseconds since the Unix epoch.

Bare integers are treated as whole seconds, which is the dominant convention (date +%s, Python time.time(), etc.). Sub-second precision requires an RFC 3339 string with a fractional seconds component.

ยงErrors

Returns FilterError::InvalidDateTime if the string is neither a valid RFC 3339 string nor a decimal integer.