Timestamps
Timestamp values, current time, parsing, formatting, and comparisons
Timestamps
Radiator uses timestamp values for current time, accounting events, certificates, RADIUS timestamp attributes, and RadiatorDB datetime fields. When Radiator renders a timestamp as text, it uses RFC3339 format.
Examples:
2026-06-24T12:34:56+03:00
2026-06-24T09:34:56Z
2026-06-24T12:34:56.123456+03:00
Current time
Use the datetime.* namespace to read the current time during pipeline
execution:
modify {
vars.local_time = datetime.timestamp;
vars.utc_time = datetime.timestamp.utc;
}
datetime.timestamp returns the current time with the server local offset.
datetime.timestamp.utc returns the current time in UTC.
The datetime.* namespace is available in runtime pipelines, including
request pipelines, @init pipelines, and timer pipelines. It is not
available in configuration-load expressions, such as file names.
Timestamp input
Radiator recognizes RFC3339 and RFC2822 timestamp strings when it converts a string value to a typed timestamp value.
RFC3339 example:
2026-06-24T12:34:56+03:00
RFC2822 example:
Wed, 24 Jun 2026 12:34:56 +0300
Configuration and backend values that are already typed as timestamps do not need separate parsing.
Use the timestamp filter to parse timestamp text or Unix timestamp seconds
explicitly:
modify {
vars.expires = vars.expires_text | timestamp;
vars.expires_from_unix = vars.expire_at_unix | timestamp;
}
Unix timestamps
Radiator compares timestamp values as Unix timestamp seconds. This means that a
numeric value can be compared with a timestamp value when the number is seconds
since 1970-01-01T00:00:00Z:
if all {
vars.expire_at_unix > datetime.timestamp;
} then {
accept;
}
Do not compare Unix millisecond, microsecond, or nanosecond values directly with timestamp values. Radiator treats the number as seconds, which makes the comparison incorrect. Convert those values to seconds before comparing them.
Timestamp comparisons use whole seconds. Subsecond precision is not used in ordering comparisons.
Timestamp output
Use timestamp values directly in logs and format strings. Radiator formats the value as RFC3339 text:
log "AUTHENTICATION" {
json {
"timestamp" datetime.timestamp;
"timestamp_utc" datetime.timestamp.utc;
}
}
To force a timestamp into a string in an expression, use the string filter:
modify {
vars.timestamp_text = datetime.timestamp | string;
}
Use timestamp_format to format a timestamp value. Without an argument, the
filter outputs RFC3339 text. The input can be a timestamp value, RFC3339 text,
RFC2822 text, or Unix timestamp seconds:
modify {
vars.timestamp_text = datetime.timestamp | timestamp_format;
vars.expire_at_text = vars.expire_at_unix | timestamp_format;
}
With a format argument, timestamp_format uses the same time format syntax as
rotated log filenames:
modify {
vars.current_date = datetime.timestamp | timestamp_format("[year]-[month]-[day]");
vars.current_hour = datetime.timestamp | timestamp_format("[hour]");
}
Timestamp format
Radiator uses bracketed time format fields for the timestamp_format() filter
and rotated-filename patterns. Literal text is copied to the output. Fields
are written inside square brackets.
timestamp_format("[year]-[month]-[day]T[hour]:[minute]:[second]")
For example, the format above can produce:
2026-06-24T08:45:12
Date fields
| Field | Description | Example |
|---|---|---|
[year] | Calendar year | 2026 |
[month] | Month number | 06 |
[day] | Day of month | 24 |
[ordinal] | Day of year | 175 |
[weekday] | Day of week | Wednesday |
[week_number] | Week number | 26 |
Time fields
| Field | Description | Example |
|---|---|---|
[hour] | Hour in 24-hour clock | 08 |
[minute] | Minute | 45 |
[second] | Second | 12 |
[subsecond] | Fractional second | 123456789 |
[period] | AM or PM marker for 12-hour output | AM |
Offset fields
| Field | Description | Example |
|---|---|---|
[offset_hour] | UTC offset hour | +03 |
[offset_minute] | UTC offset minute | 00 |
[offset_second] | UTC offset second | 00 |
Unix timestamp field
| Field | Description | Example |
|---|---|---|
[unix_timestamp] | Unix timestamp in seconds | 1782290712 |
Common modifiers
Add modifiers inside a field after the field name:
[field modifier:value modifier:value]
Common modifiers:
| Modifier example | Description |
|---|---|
[subsecond digits:3] | Output three subsecond digits. |
[offset_hour sign:mandatory] | Always include + or - in the offset hour. |
[month repr:long] | Output the full month name. |
[month repr:short] | Output the abbreviated month name. |
[weekday repr:long] | Output the full weekday name. |
[weekday repr:short] | Output the abbreviated weekday name. |
[year repr:last_two] | Output the last two digits of the year. |
[hour repr:12] | Output a 12-hour clock hour. |
[hour repr:24] | Output a 24-hour clock hour. |
[unix_timestamp precision:millisecond] | Output Unix timestamp milliseconds. |
Format examples
Date:
[year]-[month]-[day]
Output:
2026-06-24
Timestamp with offset:
[year]-[month]-[day]T[hour]:[minute]:[second][offset_hour sign:mandatory]:[offset_minute]
Output:
2026-06-24T08:45:12+03:00
Filename-safe timestamp:
[year]-[month]-[day]T[hour]-[minute]-[second].[subsecond digits:3][offset_hour sign:mandatory][offset_minute]
Output:
2026-06-24T08-45-12.123+0300
Extracting date or time parts
For simple text extraction, use timestamp_format() when possible:
modify {
vars.current_date = datetime.timestamp | timestamp_format("[year]-[month]-[day]");
}
For fixed RFC3339 fields, you can also format the timestamp as a string and
use substring():
modify {
vars.current_date = "%{datetime.timestamp | substring(0, 10)}";
}
Comparisons
Timestamp values can be compared in pipeline conditions:
if all {
cert.expires > datetime.timestamp;
} then {
accept;
} else {
reject "Certificate has expired";
}
The now expression can also be used in timestamp comparisons:
if all {
cert.expires > now;
} then {
accept;
}
Prefer datetime.timestamp in new configuration when you also need to log or
store the same timestamp value.
Error handling
Invalid field names or modifiers make the configuration invalid. Radiator
validates timestamp_format() when it loads the pipeline. Radiator validates
rotated-filename when it parses the file logger configuration.
Related information
- Execution Context -
datetime.*and other runtime namespaces. - Data Types - supported value types.
- Filters - filters for string conversion and substring extraction.
Application log message index
Architecture Overview
Backend Load Balancing
Basic Installation
Built-in Environment Variables
Byte Size Units
Certificate Revocation Lists
Comparison Operators
Configuration Editor
Configuration Import and Export
Containers
Cron and interval timers
Data Types
Duration Units
Environment Variables
Execution Context
Execution Pipelines
Filters
Getting a Radiator License
Health check /live and /ready
High Availability and Load Balancing
High availability identifiers
HTTP Basic Authentication
Introduction
Linux systemd support
Local AAA Backends
Logging
Management API privilege levels
Namespaces
Password Hashing
Password Rehashing During Login
Probabilistic Sampling
Prometheus and OpenMetrics scraping
PROXY Protocol Support
Radiator server health and boot up logic
Radiator sizing
Radiator software releases
Radiator software security and dependency compliance
RadiatorDB
RadiatorDB Backup
RadiatorDB CLI
RadiatorDB Installation
RadiatorDB PostgreSQL 10k TPS example
RadiatorDB REST API
RadiatorDB sizing
Rate Limiting
Rate Limiting Algorithms
Reverse Dynamic Authorization
Service Level Objective
TACACS+ Authentication, Authorization, and Accounting
Template Rendering CLI
Timestamps
Tools radiator-client
TOTP/HOTP Authentication
What is Radiator?
YubiKey Authentication
YubiKey Context Variables
Application log message index
Architecture Overview
Backend Load Balancing
Basic Installation
Built-in Environment Variables
Byte Size Units
Certificate Revocation Lists
Comparison Operators
Configuration Editor
Configuration Import and Export
Containers
Cron and interval timers
Data Types
Duration Units
Environment Variables
Execution Context
Execution Pipelines
Filters
Getting a Radiator License
Health check /live and /ready
High Availability and Load Balancing
High availability identifiers
HTTP Basic Authentication
Introduction
Linux systemd support
Local AAA Backends
Logging
Management API privilege levels
Namespaces
Password Hashing
Password Rehashing During Login
Probabilistic Sampling
Prometheus and OpenMetrics scraping
PROXY Protocol Support
Radiator server health and boot up logic
Radiator sizing
Radiator software releases
Radiator software security and dependency compliance
RadiatorDB
RadiatorDB Backup
RadiatorDB CLI
RadiatorDB Installation
RadiatorDB PostgreSQL 10k TPS example
RadiatorDB REST API
RadiatorDB sizing
Rate Limiting
Rate Limiting Algorithms
Reverse Dynamic Authorization
Service Level Objective
TACACS+ Authentication, Authorization, and Accounting
Template Rendering CLI
Timestamps
Tools radiator-client
TOTP/HOTP Authentication
What is Radiator?
YubiKey Authentication
YubiKey Context Variables