Skip to main content
Version: Next

Date Operators

Date operators extract calendar parts from timestamps (microseconds since Unix epoch). They are useful for time-of-day/day-of-week filtering and scheduling-style conditions.

All date operators support:

  • one operand: <timestamp>
  • two operands: <timestamp>, <timezone> where timezone is an IANA name like "Europe/Berlin"

If timezone is omitted, UTC is used.

info

$weekday uses Monday-based indexing: 0 = Monday, ..., 6 = Sunday.

Supported operators

OperatorReductStore VersionReturn value
$secondv1.190..59
$minutev1.190..59
$hourv1.190..23
$dayv1.191..31
$monthv1.191..12
$yearv1.194-digit year
$weekdayv1.190..6 (0 = Monday, 6 = Sunday)

Syntax

{
"$operator": [ <timestamp>, <optional timezone> ]
}

Use "$timestamp" to read the current record timestamp.

Examples

Records that happened during office hours in Berlin:

{
"$and": [
{ "$gte": [{ "$hour": ["$timestamp", "Europe/Berlin"] }, 9] },
{ "$lt": [{ "$hour": ["$timestamp", "Europe/Berlin"] }, 18] }
]
}

Weekday filter (Monday to Friday, UTC):

{
"$lt": [{ "$weekday": ["$timestamp"] }, 5]
}

Filter for records from January:

{
"$eq": [{ "$month": ["$timestamp"] }, 1]
}

Notes

  • Timestamp input is in microseconds.
  • Invalid timezone names return an error.
  • Use these operators with comparison/logical operators to build calendar-aware filters.