timeShift() function

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"])



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


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


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


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

Shift timestamps forward in time

import "sampledata"
    |> timeShift(duration: 12h)

View input and output

Shift timestamps backward in time

import "sampledata"
    |> timeShift(duration: -12h)

View input and output

Was this page helpful?

Thank you for your feedback!

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.