truncateTimeColumn() function
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)
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, the following resources are available:
InfluxDB Cloud customers can contact InfluxData Support.