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

1.1 KiB

title description aliases menu weight
hourSelection() function The `hourSelection()` function retains all rows with time values in a specified hour range. Hours are specified in military time.
/v2.0/reference/flux/functions/transformations/hourSelection
v2_0_ref
name parent
hourSelection built-in-transformations
401

The hourSelection() function retains all rows with time values in a specified hour range.

Function type: Transformation

hourSelection(
  start: 9,
  stop: 17,
  timeColumn: "_time"
)

Parameters

start

The first hour of the hour range (inclusive). Hours range from [0-23].

Data type: Integer

stop

The last hour of the hour range (inclusive). Hours range from [0-23].

Data type: Integer

timeColumn

The column that contains the time value. Default is "_time".

Data type: String

Examples

Use only data from 9am to 5pm
from(bucket:"example-bucket")
  |> range(start:-90d)
  |> filter(fn: (r) => r._measurement == "foot-traffic" )
  |> hourSelection(start: 9, stop: 17)