docs-v2/content/flux/v0.x/stdlib/system/time.md

1.2 KiB

title description aliases menu weight flux/v0.x/tags related introduced
system.time() function The `system.time()` function returns the current system time.
/influxdb/v2.0/reference/flux/functions/misc/systemtime
/influxdb/v2.0/reference/flux/functions/built-in/misc/systemtime
/influxdb/v2.0/reference/flux/functions/system/time/
/influxdb/v2.0/reference/flux/stdlib/system/time/
/influxdb/cloud/reference/flux/stdlib/system/time/
flux_0_x_ref
name parent
system.time system
401
date/time
/flux/v0.x/stdlib/universe/now/
/flux/v0.x/stdlib/universe/today/
0.18.0

The system.time() function returns the current system time.

import "system"

system.time()

Examples

import "system"

data
    |> set(key: "processed_at", value: string(v: system.time() ))

{{% note %}}

system.time() vs now()

system.time() returns the system time (UTC) at which system.time() is executed. Each instance of system.time() in a Flux script returns a unique value.

now() returns the current system time (UTC). now() is cached at runtime, so all instances of now() in a Flux script return the same value. {{% /note %}}