EZ Exporter Date and Time Format String Reference

You can apply a custom date/time format in EZ Exporter in 2 ways:

  1. Apply the same format to all standard Shopify datetime fields (via the "Date and Time Format" option in the Data Settings). Note that this won't apply to custom fields, use the other method below to format custom fields.
  2. Use a formula in the Calculated Fields to format individual fields.

Applying a custom format to all standard datetime fields

In the Data Settings, under the "Date and Time Format" option, select the option called Custom:

This will display an additional input field where you can specify the format string.  The format will then be applied to all standard Shopify fields of datetime data type.

Applying a custom format only to specific fields or custom fields

EZ Exporter supports a function called format_datetime() that can be used in Calculated Fields.  This allows you to only apply a custom format to specific fields or use different formats for different fields.

If you have date/time values stored in custom fields (such as Metafields, Note Attributes, and Line Item Properties), you would also use this method to change their formatting.

format_datetime(datetime, format_str="%Y-%m-%d %H:%M:%S")

By default, the date and time will be in "yyyy-mm-dd hh:mm:ss" format.

For example, the formula:

format_datetime(to_datetime({{ created_at }}))

Will return something like: 2017-09-28 11:30:22

Note here that the function to_datetime() was also used to convert the string data first to a datetime "object".

If you have a custom field where the "day" part of the date comes first (e.g. dd/mm/yyyy), make sure to specify dayfirst=True in the to_datetime() function to handle cases where it's not clear which part is the day or the month (e.g. 01/02/2021):

format_datetime(to_datetime("01/02/2021", dayfirst=True))

To change the formatting, simply override the format_str parameter with your desired format using the table below.

For instance, this formula:

format_datetime(to_datetime({{ created_at }}), "%A %B %d, %Y")

Will return something like: Thursday September 28, 2017

You can also pass in a datetime string in ISO 8601 format without using the to_datetime() function like this:

format_datetime("2023-05-19", "%d %b %Y")

This will output: 19 May 2023

Please don't hesitate to contact us if you're having trouble.

Format String Reference

Code Meaning Example
%a Weekday as locale’s abbreviated name. Mon
%A Weekday as locale’s full name. Monday
%w Weekday as a decimal number, where 0 is Sunday and 6 is Saturday. 1
%d Day of the month as a zero-padded decimal number. 30
%b Month as locale’s abbreviated name. Sep
%B Month as locale’s full name. September
%m Month as a zero-padded decimal number. 09
%y Year without century as a zero-padded decimal number. 13
%Y Year with century as a decimal number. 2013
%H Hour (24-hour clock) as a zero-padded decimal number. 07
%I Hour (12-hour clock) as a zero-padded decimal number. 07
%p Locale’s equivalent of either AM or PM. AM
%M Minute as a zero-padded decimal number. 06
%S Second as a zero-padded decimal number. 05
%f Microsecond as a decimal number, zero-padded on the left. 000000
%z UTC offset in the form +HHMM or -HHMM (empty string if the the object is naive).  
%Z Time zone name (empty string if the object is naive).  
%j Day of the year as a zero-padded decimal number. 273
%U Week number of the year (Sunday as the first day of the week) as a zero padded decimal number. All days in a new year preceding the first Sunday are considered to be in week 0. 39
%W Week number of the year (Monday as the first day of the week) as a decimal number. All days in a new year preceding the first Monday are considered to be in week 0. 39
%c Locale’s appropriate date and time representation. Mon Sep 30 07:06:05 2013
%x Locale’s appropriate date representation. 09/30/13
%X Locale’s appropriate time representation. 07:06:05
%% A literal '%' character. %

App: EZ Exporter

Tags: advanced features, functions, reference