truncateTimeColumn() function

The truncateTimeColumn() function truncates all input table _time values to a specified unit.

truncateTimeColumn(unit: 1s)

Truncate to weeks

When truncating a time value to the week (1w), weeks are determined using the Unix epoch (1970-01-01T00:00:00Z UTC). The Unix epoch was on a Thursday, so all calculated weeks begin on Thursday.



The unit of time to truncate to.

Only use 1 and the unit of time to specify the unit. For example: 1s, 1m, 1h.


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


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

Truncate all time values to minutes
import "sampledata"

data =
    |> range(start: sampledata.start, stop: sampledata.stop)

    |> truncateTimeColumn(unit: 1m)

View input and output

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.