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"])
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)
Shift timestamps backward in time
import "sampledata"
sampledata.int()
|> timeShift(duration: -12h)
Was this page helpful?
Thank you for your feedback!
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for Flux and this documentation. To find support, use the following resources:
InfluxDB Cloud customers can contact InfluxData Support.