docs-v2/content/v2.0/reference/flux/functions/built-in/transformations/timeshift.md

1.1 KiB

title description aliases menu weight
timeShift() function The `timeShift()` function adds a fixed duration to time columns.
/v2.0/reference/flux/functions/transformations/shift
/v2.0/reference/flux/functions/built-in/transformations/shift
v2_0_ref
name parent
timeShift built-in-transformations
401

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.

Function type: Transformation

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

Parameters

duration

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

Data type: Duration

columns

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

Data type: Array of strings

Examples

Shift forward in time
from(bucket: "example-bucket")
	|> range(start: -5m)
	|> timeShift(duration: 12h)
Shift backward in time
from(bucket: "example-bucket")
	|> range(start: -5m)
	|> timeShift(duration: -12h)