Date and Time Filtering in Custom Filters

EZ Exporter for Shopify: Custom Date Filters

We provide additional flexibility when filtering date fields (such as the Created At, Updated At, and Processed At fields) in the Custom Filters. Note that these fields are really timestamps and contain not just the date but also the time and timezone in ISO 8601 format.

Since the dates also include the time, you'd normally only filter these fields with the is greater than/is greater than or equal to or is less than/is less than or equal to filter conditions.

We also provide special date variable keywords such as {{ current_date }} that you can use when filtering date fields. Note that by default, {{ current_date }} will have the time 00:00:00. If you need to filter by a specific time you can append the time to it like this (in ISO 8601 format):

{{ current_date }}T23:59:59

You can also add and subtract days to {{ current_date }}, for example:

Subtract 1 day.

{{ current_date }} - 1

Subtract 7 days.

{{ current_date }}T23:59:59 - 7

Important: The space before and after the "-" character matters here.

If you need to hardcode dates in the filter, just make sure it's in ISO 8601 format.

2017-03-31
2017-03-31T08:30

We'll automatically handle the timezone for you based on your store's timezone setting.

Below is the full list of available date variables (note that these variables will only work when filtering standard Shopify date/time fields):

  • {{ current_date }} (e.g. 2018-05-13)
  • {{ current_year }} (e.g. 2018)
  • {{ current_month }} (e.g. 05)
  • {{ current_day }} (e.g. 13)
  • {{ previous_month }} (e.g. 04)
  • {{ previous_month_with_year }} (e.g. 2018-04 , if the current month is January, then this will be 2017-12)
  • {{ last_successful_run }} (the start timestamp of the last successful run of the Export Profile associated with the Data Settings)
  • {{ last_successful_run_with_data }} (the start timestamp of the last successful run that contained data)
  • {{ current_task_start_time }} (the start timestamp of the current export task)

Important Note:  It's important to make sure that you use full dates (time is optional and defaults to 00:00:00).  For example, don't just use {{ current_month }} on its own and use something like 2020-{{ current_month }}-{{ current_day }} instead so it's the full date value in ISO 8601 format.

Just to summarize:

  • You'd normally want to use only the is greater than/is greater than or equal to or is less than/is less than or equal to filter conditions.
  • The date and time format must be in ISO 8601.
  • We'll handle the timezone automatically on the backend based on your store's timezone setting, so you don't need to specify the timezone.
  • You can add and subtract days with the {{ current_date }} variable.

Examples

I want to filter my Product export to only include the variants that were updated yesterday.

Data matching all of the following conditions:

  • Variant Updated At is greater than {{ current_date }} - 1
  • Variant Updated At is less than {{ current_date }}

(Note here that the time by default is 00:00:00.)

I want to filter my Order export to only include orders that were placed between 9:00 AM and 4:30 PM today.

Data matching all of the following conditions:

  • Created At is greater than {{ current_date }}T09:00
  • Created At is is less than {{ current_date }}T16:30

I want to filter my Order export to only include orders that were placed from exactly 9:00:00 AM until 3:59:59 PM today.

Data matching all of the following conditions:

  • Created At is greater than or equal to {{ current_date }}T09:00:00
  • Created At is is less than or equal to {{ current_date }}T15:59:59

I want to filter my Order export to only include orders that were placed from March 1, 2020 to March 5, 2020.

Data matching all of the following conditions:

  • Created At is greater than 2020-03-01
  • Created At is is less than 2020-03-06

Note here that we didn't specify the time, which defaults to 00:00:00 and this is why the "less than" condition is on 2020-03-06 (i.e. less than 2020-03-06T00:00:00 is 2020-03-05T23:59:59 and earlier).

I want to filter my Customer export to only include customers that were updated in the last 14 days.

Data matching all of the following conditions:

  • Updated At is greater than {{ current_date }} - 14

Related Articles:


App: EZ Exporter

Tags: advanced features