Skip to main content

Module time

Module time 

Source
Expand description

Time-range parsing for Datadog CLI commands.

Accepts three forms:

  • Relative shorthand: {N}{s|m|h|d|w} (e.g. 15m, 1h, 7d).
  • Literal now.
  • RFC 3339 timestamps (timezone required, e.g. 2026-04-22T10:00:00Z).
  • Unix epoch seconds (non-negative integer).

All results are returned as epoch seconds (i64) — the unit expected by Datadog v1 query parameters.

Functions§

parse_instant
Parses a single time instant relative to now.
parse_time_range
Parses a (from, to) pair. When to is None, defaults to now.