Radiator Server Documentation — v10.33.4

Timestamps

Timestamp values, current time, parsing, formatting, and comparisons

Table of Contents
  • Timestamps
  • Current time
  • Timestamp input
  • Unix timestamps
  • Timestamp output
  • Extracting date or time parts
  • Comparisons
  • Related information

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. See Timestamp Format for the available fields and modifiers:

modify {
    vars.current_date = datetime.timestamp | timestamp_format("[year]-[month]-[day]");
    vars.current_hour = datetime.timestamp | timestamp_format("[hour]");
}

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.

Navigation
  • About Radiator software development security

  • 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

  • Log storage and formatting

  • Management API privilege levels

  • Namespaces

  • Password Hashing

  • Password Rehashing During Login

  • Probabilistic Sampling

  • Prometheus scraping

  • PROXY Protocol Support

  • Radiator server health and boot up logic

  • Radiator sizing

  • Radiator software releases

  • RadiatorDB

  • RadiatorDB Backup

  • RadiatorDB CLI

  • RadiatorDB Installation

  • RadiatorDB REST API

  • Rate Limiting

  • Rate Limiting Algorithms

  • Reverse Dynamic Authorization

  • Service Level Objective

  • TACACS+ Authentication, Authorization, and Accounting

  • Template Rendering CLI

  • Timestamp Format

  • Timestamps

  • Tools radiator-client

  • TOTP/HOTP Authentication

  • What is Radiator?

  • YubiKey Authentication

  • YubiKey Context Variables