toTime() function

The toTime() function converts all values in the _value column to times.

*Function type: Type conversion*

  1. toTime()

*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.

Examples

  1. from(bucket: "telegraf")
  2. |> filter(fn:(r) =>
  3. r._measurement == "mem" and
  4. r._field == "used"
  5. )
  6. |> toTime()

Function definition

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

*Used functions: map(), time()*