= Single Letter Expansions

The following are single letter expansions.

The xref:xlat/builtin.adoc[builtin] `%time(...)` expansion and the
xref:raddb:mods-available/date.adoc[date] module should be used
instead of these expansions.


== Current Time

`%c()`::

The current Unix epoch time in seconds. This is an unsigned decimal number.

`%C()`::

The microsecond component of the current epoch time. This is an unsigned
decimal number.

Note that creating a "fractional" time from an expansion like `%c.%C`
should only be used when creating strings, such as for logging.  If
you need to calculate time differences, the time values should be left
as type `date`, and then you can substract two dates to get a
`time_delta`.  That `time_delta` can then be printed in an appropriate
precision and scale.

== Request Time

`%l()`::

The Unix timestamp of when the request was received. This is an
unsigned decimal number, and returns an integer number of seconds
since the Unix epoch.

This expansion is only useful where the time resolution is in seconds.
If more resolution is needed, the xref:xlat/builtin.adoc[builtin]
`%time(...)` expansion should be used instead.

`%Y()`::

Four-digit year when the request was received.

`%m()`::

Numeric month when the request was received.

`%d()`::

Numeric day of the month when the request was received.

`%H()`::

Hour of the day when the request was received.

`%G()`::

Minute component of the time when the request was received.

`%e()`::

Second component of the time when the request was received.

`%M()`::

Microsecond component of the time when the request was received.

`%D()`::

Request date in the format `YYYYMMDD`.

`%S()`::

Request timestamp in SQL format, `YYYY-mmm-ddd HH:MM:SS`.

The xref:raddb:mods-available/date.adoc[date] module should be used
instead.

`%t()`::

Request timestamp in _ctime_ format, `Www Mmm dd HH:MM:SS YYYY`.

The xref:raddb:mods-available/date.adoc[date] module should be used
instead.

`%T()`::

Request timestamp in ISO format, `YYYY-mm-ddTHH:MM:SS.000`.

The xref:raddb:mods-available/date.adoc[date] module should be used
instead.

// Copyright (C) 2023 Network RADIUS SAS.  Licenced under CC-by-NC 4.0.
// This documentation was developed by Network RADIUS SAS.
