---
schema_version: "1"
id: f1ebf0e52c417088301f9d5e38674b9f3b23f4df54bae2a06cdebb608295f98a
title: ARRAY_GENERATE_SERIES (Time-based)
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/data-cloud/data-cloud-query-guide/references/data-cloud-sql-reference/scalar-func/array-func/array-generate-series-time.md
canonical_url: https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/array-generate-series-time.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: e1fb063c7122de4b0446c157d9d2161cdc93ab9fbdf41dc5a4c30b492b330097
products:
  - Data 360 Query Guide
  - Data 360 Developer Documentation
---
# `ARRAY_GENERATE_SERIES` (Time-based)

**Applies to:** ✅ Data 360 SQL ✅ Tableau Hyper API

Generate an array of time-based values, from `start` to `stop` with a given `step` size.

## Syntax

```sql
array_generate_series(<start>, <stop>, <step>)
```

## Arguments

### Required

- `<start>`: The start value of the series. Can be of type `DATE`, `TIMESTAMP`, or `TIMESTAMP WITH TIME ZONE`.
- `<stop>`: The end value of the series. Must be of the same type as `<start>`.
- `<step>`: The step size as an `INTERVAL`. Unlike the numerical version of `ARRAY_GENERATE_SERIES`, the step size is always required for time-based series.

## Returns

Returns an `ARRAY` containing the generated series of values.

## Considerations

This function is equivalent to the [generate_series (Time-based)](https://developer.salesforce.com/docs/data/data-cloud-query-guide/set-returning-func/generate-series-time.md) function, with the only difference that it returns an array instead of a set of rows.
Read the documentation on `generate_series (Time-based)` for more details.
All considerations also apply to `array_generate_series` with the following differences:

## Examples

### Basic Usage with Dates

Generate an array of months between two dates.

```sql
SELECT array_generate_series('2017-01-01'::date, '2017-03-01'::date, '1 month'::interval);
```

returns `["2017-01-01","2017-02-01","2017-03-01"]`

### Usage with Timestamps

```sql
SELECT array_generate_series('2017-01-01 01:02:03'::timestamp, '2017-03-01 01:02:03'::timestamp, '1 month'::interval);
```

returns `["2017-01-01 01:02:03","2017-02-01 01:02:03","2017-03-01 01:02:03"]`

### Additional Examples

Take a look at the [generate_series examples](https://developer.salesforce.com/docs/data/data-cloud-query-guide/set-returning-func/generate-series-time.md#examples) for additional examples.
They also apply to `array_generate_series`.

## Related Documentation

- [Array Functions](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/arrays.md)
- [`ARRAY_GENERATE_SERIES` (Numerical)](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/array-generate-series.md) - the numerical version of this function
- [`generate_series` (Time-based)](https://developer.salesforce.com/docs/data/data-cloud-query-guide/set-returning-func/generate-series-time.md) - the set-returning version of this function
