toTime() function

The toTime() function converts a value to a time.

Function type: Type conversion


Supported data types: Integer | String | Uinteger

toTime() assumes all numeric input values are nanosecond epoch timestamps.

To convert values in a column other than _value, define a custom function patterned after the function definition, but replace _value with your desired column.


from(bucket: "telegraf")
  |> filter(fn:(r) =>
    r._measurement == "mem" and
    r._field == "used"
  |> toTime()

Function definition

toTime = (tables=<-) =>
    |> map(fn:(r) => ({ r with _value: time(v:r._value) }))

This documentation is open source. See a typo? Please, open an issue.

Need help getting up and running? Get Support