Can I use date and time variables in the file paths, URLs, and filters?

Yes, this is indeed possible!

The following date/time variables are available, which are based on the current date and time (using the Shopify store's timezone setting):

  • {{ YYYY }} - the current year (e.g. 2018)
  • {{ MM }} - the current month (e.g. 09)
  • {{ DD }} - the current day (e.g. 21)
  • {{ HH }} - the current hour in 24-hour format (e.g. 18)

Using Date Variables in FTP or SFTP File Paths

EZ Inventory - Shopify Inventory Management - FTP File Path

In the File Path field in EZ Inventory, you can specify the file path to be something like this:

/feeds/stock_{{ YYYY }}_{{ MM }}_{{ DD }}.csv

This will be automatically converted by our app to: /feeds/stock_2018_09_21.csv

You can also use the date variables in the directory paths like this:

/feeds/{{ YYYY }}/{{ MM }}/{{ DD }}/stock.csv

This will produce the following: /feeds/2018/09/21/stock.csv

Using Date Variables in the Data Feed Filters

EZ Inventory - Shopify Inventory App - Feed Data Filters with Date Variables

For example, if you have one big data feed that contains historical inventory data, it might have a "Date" field specifying the date of the stock level. With the date variables, you can tell our app to only sync the data whose "Date" field matches the current date.

Another use case is if the data feed uses a static filename like "stock.csv" but the feed might not get updated daily and we want to ensure that we only sync the data if it's up to date. So in this case, if the data feed has a date field specifying when the inventory data was last updated, we can then use the date variables in the filters so the Shopify inventory quantity will only get updated if the date in the data feed itself matches the current date.

Advanced Formatting

We also offer a more advanced date/time formatting via the {{ current_datetime }} variable, where you have much more options on the date/time format and also the ability to add or subtract days.

Examples:

Format the current date as M-D-YY without zero-padding (e.g. 1-2-23):

{{ current_datetime|format:%-m-%-d-%y }}

Format the current date as AbbrevMonth DD, YYYY (e.g. Jan 02, 2023)

{{ current_datetime|format:%b %d, %Y }}

Format the current date as YYYY-MM-DD, then add 2 days.

{{ current_datetime|format:%Y-%m-%d|add_days:2 }}

Format the current date as YYYY-MM-DD, then subtract 1 day.

{{ current_datetime|format:%Y-%m-%d|add_days:-1 }}

Format the current date as YYYY-MM-DD_HH in America/New_York timezone (by default, the Shopify store's timezone setting is used, this allows you to overwrite the timezone).

{{ current_datetime|format:%Y-%m-%d_%H|set_timezone:America/New_York }}

For a list of available format options, please click here.

For a list of valid timezone values, please click here.


Related Articles:


App: EZ Inventory

Tags: faq, advanced features, inventory management