Documentation

truncateTimeColumn() function

Flux 0.37.0+

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.

Parameters

unit

The unit of time to truncate to.

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

tables

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

Examples

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 = sampledata.int()
  |> range(start: sampledata.start, stop: sampledata.stop)

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