Back to Influxdb

today() function

content/flux/v0/stdlib/universe/today.md

latest1.3 KB
Original Source
<!------------------------------------------------------------------------------ IMPORTANT: This page was generated from comments in the Flux source code. Any edits made directly to this page will be overwritten the next time the documentation is generated. To make updates to this documentation, update the function comments above the function definition in the Flux source code: https://github.com/influxdata/flux/blob/master/stdlib/universe/universe.flux#L4833-L4833 Contributing to Flux: https://github.com/influxdata/flux#contributing Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md ------------------------------------------------------------------------------->

today() returns the now() timestamp truncated to the day unit.

Function type signature
js
() => time

{{% caption %}} For more information, see Function type signatures. {{% /caption %}}

Examples

Return a timestamp representing today

js
option now = () => 2022-01-01T13:45:28Z

today()// Returns 2022-01-01T00:00:00.000000000Z


Query data from today

js
from(bucket: "example-bucket")
    |> range(start: today())