Documentation

toTime() function

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

toTime()

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.

Supported data types

toTime() treats all numeric input values as nanosecond epoch timestamps.

Parameters

tables

Input data. Default is piped-forward data (<-).

Examples

The following example uses data provided by the sampledata package to show how toTime() transforms data.

Convert an integer value column to a time column

import "sampledata"

data = sampledata.int()
    |> map(fn: (r) => ({r with _value: r._value * 1000000000}))

data
    |> toTime()

View input and output


Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.