This page explains how to use the unixtime_nanoseconds_todatetime function in APL.
unixtime_nanoseconds_todatetime
converts a Unix timestamp that is expressed in whole nanoseconds since 1970-01-01 00:00:00 UTC to an APL datetime
value.
Use the function whenever you ingest data that stores time as epoch nanoseconds (for example, JSON logs from NGINX or metrics that follow the StatsD line protocol). Converting to datetime
lets you bin, filter, and visualize events with the rest of your time-series data.
Splunk SPL users
_time
in seconds and uses functions such as strftime
or strptime
for conversion. In APL, you pass the nanosecond integer directly to unixtime_nanoseconds_todatetime
, so you don’t divide by 1,000,000,000 first.ANSI SQL users
TO_TIMESTAMP_LTZ()
or similar functions that expect seconds or microseconds. In APL, you pass the nanosecond value directly, and the function returns a datetime
(UTC).Name | Type | Description |
---|---|---|
nanoseconds | int or long | Whole nanoseconds since the Unix epoch. Fractional input is truncated. |
datetime
value that represents the given epoch nanoseconds at UTC precision (1 nanosecond).
_time | epoch_nanoseconds | datetime_standard |
---|---|---|
May 15, 12:09:22 | 1,747,303,762 | 2025-05-15T10:09:22Z |
datetime
value.datetime
value.datetime
value.