---
title: experimental.alignTime() function
description: experimental.alignTime() shifts time values in input tables to all start at a common start time.
url: https://docs.influxdata.com/flux/v0/stdlib/experimental/aligntime/
estimated_tokens: 1549
product: Flux
version: v0
---

# experimental.alignTime() function

-   Flux 0.66.0+
-   View InfluxDB support

`experimental.alignTime()` is [subject to change at any time](/flux/v0/stdlib/experimental/#experimental-packages-are-subject-to-change).

`experimental.alignTime()` shifts time values in input tables to all start at a common start time.

##### Function type signature

```js
(<-tables: stream[B], ?alignTo: A) => stream[C] where B: Record, C: Record
```

For more information, see [Function type signatures](/flux/v0/function-type-signatures/).

## Parameters

### alignTo

Time to align tables to. Default is `1970-01-01T00:00:00Z`.

### tables

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

## Examples

### Compare month-over-month values

1. Window data by calendar month creating two separate tables (one for January and one for February).
2. Align tables to `2021-01-01T00:00:00Z`.

Each output table represents data from a calendar month. When visualized, data is still grouped by month, but timestamps are aligned to a common start time and values can be compared by time.

```js
import "experimental"

data
    |> window(every: 1mo)
    |> experimental.alignTime(alignTo: 2021-01-01T00:00:00Z)
```

[](#view-example-input-and-output)

View example input and output

#### Input data

| *_start | *_stop | _time | _value |
| --- | --- | --- | --- |
| 2021-01-01T00:00:00Z | 2021-03-01T00:00:00Z | 2021-01-01T00:00:00Z | 32.1 |
| 2021-01-01T00:00:00Z | 2021-03-01T00:00:00Z | 2021-01-02T00:00:00Z | 32.9 |
| 2021-01-01T00:00:00Z | 2021-03-01T00:00:00Z | 2021-01-03T00:00:00Z | 33.2 |
| 2021-01-01T00:00:00Z | 2021-03-01T00:00:00Z | 2021-01-04T00:00:00Z | 34 |
| 2021-01-01T00:00:00Z | 2021-03-01T00:00:00Z | 2021-02-01T00:00:00Z | 38.3 |
| 2021-01-01T00:00:00Z | 2021-03-01T00:00:00Z | 2021-02-02T00:00:00Z | 38.4 |
| 2021-01-01T00:00:00Z | 2021-03-01T00:00:00Z | 2021-02-03T00:00:00Z | 37.8 |
| 2021-01-01T00:00:00Z | 2021-03-01T00:00:00Z | 2021-02-04T00:00:00Z | 37.5 |

#### Output data

| *_start | *_stop | _time | _value |
| --- | --- | --- | --- |
| 2021-01-01T00:00:00Z | 2021-02-01T00:00:00Z | 2021-01-01T00:00:00Z | 32.1 |
| 2021-01-01T00:00:00Z | 2021-02-01T00:00:00Z | 2021-01-02T00:00:00Z | 32.9 |
| 2021-01-01T00:00:00Z | 2021-02-01T00:00:00Z | 2021-01-03T00:00:00Z | 33.2 |
| 2021-01-01T00:00:00Z | 2021-02-01T00:00:00Z | 2021-01-04T00:00:00Z | 34 |

| *_start | *_stop | _time | _value |
| --- | --- | --- | --- |
| 2021-02-01T00:00:00Z | 2021-03-01T00:00:00Z | 2021-01-01T00:00:00Z | 38.3 |
| 2021-02-01T00:00:00Z | 2021-03-01T00:00:00Z | 2021-01-02T00:00:00Z | 38.4 |
| 2021-02-01T00:00:00Z | 2021-03-01T00:00:00Z | 2021-01-03T00:00:00Z | 37.8 |
| 2021-02-01T00:00:00Z | 2021-03-01T00:00:00Z | 2021-01-04T00:00:00Z | 37.5 |

[transformations](/flux/v0/tags/transformations/) [date/time](/flux/v0/tags/date/time/)
