---
title: 'SINCE, UNTIL, DURING'
description: Filter ShopifyQL queries by date and time ranges.
api_version: 2026-07
source_url:
  html: 'https://shopify.dev/docs/api/shopifyql/latest/syntax/since-until-during'
  md: 'https://shopify.dev/docs/api/shopifyql/latest/syntax/since-until-during.md'
api_name: shopifyql
---

# SINCE, UNTIL, DURING

Use `SINCE` and `UNTIL`, or `DURING`, to choose one reporting period for a ShopifyQL query. Use `SINCE` to set an explicit start boundary, and add `UNTIL` to set an explicit end boundary. Use `DURING` for a predefined reporting period, such as `last_month` or `bfcm2025`. Because `DURING` already defines the full reporting period, don't combine it with `SINCE` or `UNTIL` in the same query.

For `SINCE` and `UNTIL`, date parameters can use [absolute](#absolute-dates), [relative](#relative-dates), [named date ranges](#named-date-ranges), or [date functions](#date-functions). To compare the selected period to another period, use [`COMPARE TO`](https://shopify.dev/docs/api/shopifyql/latest/syntax/compare-to).

**Note:**

When a query uses [`TIMESERIES`](https://shopify.dev/docs/api/shopifyql/latest/syntax/timeseries), ShopifyQL returns every value of the selected time dimension across a reporting period. Use `SINCE`, `UNTIL`, or `DURING` to set that period explicitly. Otherwise, ShopifyQL applies [default date ranges](https://shopify.dev/docs/api/shopifyql/latest/syntax/timeseries#default-date-ranges) for `TIMESERIES`.

## Syntax

```shopifyql
date_range_clause:
  SINCE date_parameter [UNTIL date_parameter]
  UNTIL date_parameter
  DURING named_date_range


date_parameter:
  date_range_operator
  named_date_range
  date_function
```

***

## SINCE and UNTIL

Use `SINCE` to set the inclusive start of the reporting period. Add `UNTIL` to set the inclusive end. If you use `SINCE` without `UNTIL`, then ShopifyQL uses `now` as the end date.

If you use `UNTIL` without `SINCE`, then the query must include [`TIMESERIES`](https://shopify.dev/docs/api/shopifyql/latest/syntax/timeseries) so ShopifyQL can apply a default start date. If both boundaries resolve to dates or date-times, then the `UNTIL` boundary can't be before the `SINCE` boundary.

Use explicit date boundaries when you need direct control over the reporting period. `SINCE` sets the inclusive start boundary, and `UNTIL` sets the inclusive end boundary.

* **SINCE**

  **SINCE \<date\_offset>**

  Sets the starting date or date-time for the query range.

* **UNTIL**

  **UNTIL \<date\_offset>**

  Sets the ending date or date-time for the query range.

Examples

### Examples

* ####

  ##### Description

  Show \[\`gross\_sales\`]\(/docs/api/shopifyql/latest/schemas/sales\_revenue/sales#salesmetric-propertydetail-grosssales), \`discounts\`, and \`net\_sales\` for January 2026. This example uses \`SINCE 2026-01-01 UNTIL 2026-01-31\` to set explicit start and end dates.

  ##### ShopifyQL

  ```shopifyql
  FROM sales
    SHOW gross_sales, discounts, net_sales
    SINCE 2026-01-01 UNTIL 2026-01-31
  ```

* ####

  ##### Description

  Break out \[\`sessions\`]\(/docs/api/shopifyql/latest/schemas/sessions\_and\_behavior/sessions#sessionsmetric-propertydetail-sessions) and \`conversion\_rate\` for each day of last month. This example uses \`SINCE startOfMonth(-1m) UNTIL endOfMonth(-1m)\`, which always resolves to last month as time passes.

  ##### ShopifyQL

  ```shopifyql
  FROM sessions
    SHOW sessions, conversion_rate
    TIMESERIES day
    SINCE startOfMonth(-1m) UNTIL endOfMonth(-1m)
    ORDER BY day ASC
  ```

***

## DURING

Use `DURING` when a named date range defines the full reporting period. `DURING` replaces explicit `SINCE` and `UNTIL` boundaries, so don't combine it with either clause.

`DURING` accepts [named date ranges](#named-date-ranges) only and doesn't accept `now`. Use `SINCE` and `UNTIL` when you need `now`, an absolute date or date-time, a relative offset, or a date function as a boundary.

Examples

### Examples

* ####

  ##### Description

  Break down \[\`net\_payments\`]\(/docs/api/shopifyql/latest/schemas/finance\_and\_payments/payments#paymentsmetric-propertydetail-netpayments) and transactions by payment method for last month. This example uses \`DURING last\_month\` to select a named period without spelling out the dates.

  ##### ShopifyQL

  ```shopifyql
  FROM payments
    SHOW net_payments, transactions
    GROUP BY payment_method
    DURING last_month
    ORDER BY net_payments DESC
  ```

* ####

  ##### Description

  List \[\`total\_sales\`]\(/docs/api/shopifyql/latest/schemas/sales\_revenue/sales#salesmetric-propertydetail-totalsales) and \`orders\` for each day of the 2020 BFCM weekend. This example uses \`DURING bfcm2020\` to select the built-in sales-event range, which resolves to the exact weekend dates.

  ##### ShopifyQL

  ```shopifyql
  FROM sales
    SHOW total_sales, orders
    TIMESERIES day
    DURING bfcm2020
    ORDER BY day ASC
  ```

***

## Absolute dates

Use absolute dates and absolute date-time values as date parameters. Date parameters aren't wrapped in quotes.

| Date format | Syntax | Description |
| - | - | - |
| absolute date | `yyyy-MM-dd` | A specific date. |
| absolute date-time | `yyyy-MM-ddThh:mm:ss` | A specific date and time. |

***

## Relative dates

Use relative offsets with an optional sign, a whole number, and a supported unit.

| Date format | Syntax | Description |
| - | - | - |
| seconds | `[-]<number>s` | Number of seconds from query time. |
| minutes | `[-]<number>min` | Number of minutes from query time. |
| hours | `[-]<number>h` | Number of hours from query time. |
| days | `[-]<number>d` | Number of calendar days from query time. |
| weeks | `[-]<number>w` | Number of calendar weeks from query time. |
| months | `[-]<number>m` | Number of calendar months from query time. |
| quarters | `[-]<number>q` | Number of calendar quarters from query time. |
| years | `[-]<number>y` | Number of calendar years from query time. |

Examples

### Examples

* ####

  ##### Description

  Summarize \[\`net\_sales\`]\(/docs/api/shopifyql/latest/schemas/sales\_revenue/sales#salesmetric-propertydetail-netsales) and \`orders\` by quarter from four quarters ago through one quarter ago. This example uses \`SINCE -4q UNTIL -1q\` to bound the window with relative offsets that shift forward each quarter.

  ##### ShopifyQL

  ```shopifyql
  FROM sales
    SHOW net_sales, orders
    TIMESERIES quarter
    SINCE -4q UNTIL -1q
    ORDER BY quarter ASC
  ```

* ####

  ##### Description

  Track \[\`sessions\`]\(/docs/api/shopifyql/latest/schemas/sessions\_and\_behavior/sessions#sessionsmetric-propertydetail-sessions) for each hour of the last 24 hours. This example uses \`SINCE -24h UNTIL now\` to bound the window down to the hour.

  ##### ShopifyQL

  ```shopifyql
  FROM sessions
    SHOW sessions
    TIMESERIES hour
    SINCE -24h UNTIL now
    ORDER BY hour ASC
  ```

***

## Named date ranges

To compare the selected period with a relative period such as `previous_period`, use [`COMPARE TO`](https://shopify.dev/docs/api/shopifyql/latest/syntax/compare-to).

Use named date ranges for common reporting periods. `SINCE` and `UNTIL` can use named values as date boundaries. `DURING` uses a named date range as the whole reporting period and doesn't accept `now`.

| Named range | Description |
| - | - |
| `now` | The date and time that the query runs. |
| `today` | The day that the query runs. |
| `yesterday` | The previous 24-hour period from query time. |
| `this_week` | The current calendar week. |
| `this_weekend` | The current weekend. |
| `last_weekend` | The previous weekend. |
| `this_month` | The current calendar month. |
| `this_quarter` | The current calendar quarter. |
| `this_year` | The current calendar year. |
| `last_week` | The previous calendar week. |
| `last_month` | The previous calendar month. |
| `last_quarter` | The previous calendar quarter. |
| `last_year` | The previous calendar year. |
| `bfcm2020, bfcm2021, ...` | The BFCM range for the specified year. |

Examples

### Examples

* ####

  ##### Description

  Track \[\`gross\_sales\`]\(/docs/api/shopifyql/latest/schemas/sales\_revenue/sales#salesmetric-propertydetail-grosssales), \`net\_sales\`, and \`orders\` by month for the current year. This example uses \`DURING this\_year\` to select the year-to-date period by name.

  ##### ShopifyQL

  ```shopifyql
  FROM sales
    SHOW gross_sales, net_sales, orders
    TIMESERIES month
    DURING this_year
    ORDER BY month ASC
  ```

* ####

  ##### Description

  Break out \[\`sessions\`]\(/docs/api/shopifyql/latest/schemas/sessions\_and\_behavior/sessions#sessionsmetric-propertydetail-sessions) and \`conversion\_rate\` for each hour of the current day. This example uses \`DURING today\` to select the current day by name.

  ##### ShopifyQL

  ```shopifyql
  FROM sessions
    SHOW sessions, conversion_rate
    TIMESERIES hour
    DURING today
    ORDER BY hour ASC
  ```

***

## Date functions

Use date functions to align a relative offset with the start or end of its matching time unit. Use `startOf*` functions with `SINCE` and `endOf*` functions with `UNTIL`. The function's time unit must match the relative offset unit.

| Time unit | Functions | Description |
| - | - | - |
| minute | `startOfMinute(-<number>min) \| endOfMinute(-<number>min)` | Truncates to the beginning or end of the target minute. |
| hour | `startOfHour(-<number>h) \| endOfHour(-<number>h)` | Truncates to the beginning or end of the target hour. |
| day | `startOfDay(-<number>d) \| endOfDay(-<number>d)` | Truncates to the beginning or end of the target day. |
| week | `startOfWeek(-<number>w) \| endOfWeek(-<number>w)` | Truncates to the beginning or end of the target week. |
| month | `startOfMonth(-<number>m) \| endOfMonth(-<number>m)` | Truncates to the beginning or end of the target month. |
| quarter | `startOfQuarter(-<number>q) \| endOfQuarter(-<number>q)` | Truncates to the beginning or end of the target quarter. |
| year | `startOfYear(-<number>y) \| endOfYear(-<number>y)` | Truncates to the beginning or end of the target year. |

Examples

### Examples

* ####

  ##### Description

  Track \[\`net\_sales\`]\(/docs/api/shopifyql/latest/schemas/sales\_revenue/sales#salesmetric-propertydetail-netsales) and \`orders\` by day from 30 days ago through yesterday. This example uses \`SINCE startOfDay(-30d) UNTIL endOfDay(-1d)\` to snap the boundaries to whole days, excluding today's partial data.

  ##### ShopifyQL

  ```shopifyql
  FROM sales
    SHOW net_sales, orders
    TIMESERIES day
    SINCE startOfDay(-30d) UNTIL endOfDay(-1d)
    ORDER BY day ASC
  ```

* ####

  ##### Description

  Track \[\`sessions\`]\(/docs/api/shopifyql/latest/schemas/sessions\_and\_behavior/sessions#sessionsmetric-propertydetail-sessions) and \`conversion\_rate\` by month over the last three full months. This example uses \`SINCE startOfMonth(-3m) UNTIL endOfMonth(-1m)\` to snap the boundaries to whole months, excluding the current partial month.

  ##### ShopifyQL

  ```shopifyql
  FROM sessions
    SHOW sessions, conversion_rate
    TIMESERIES month
    SINCE startOfMonth(-3m) UNTIL endOfMonth(-1m)
    ORDER BY month ASC
  ```

***
