Documentation

timeShift() function

Flux 0.7.0+

The timeShift() function adds a fixed duration to time columns. The output table schema is the same as the input table. If the time is null, the time will continue to be null.

timeShift(duration: 10h, columns: ["_start", "_stop", "_time"])

Parameters

duration

(Required) The amount of time to add to each time value. May be a negative duration.

columns

The list of all columns to be shifted. Default is ["_start", "_stop", "_time"].

tables

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

Examples

The following examples use data provided by the sampledata package to show how timeShift() transforms data.

Shift timestamps forward in time

import "sampledata"

sampledata.int()
  |> timeShift(duration: 12h)

View input and output

Shift timestamps backward in time

import "sampledata"

sampledata.int()
  |> timeShift(duration: -12h)

View input and output


Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.