Home > Shopify Development > Liquid date: How to Format Date, Convert to New Format

How to Format Date, Convert to New Format in Shopify

Sam Nguyen
Sam Updated: August 04, 2024

Share:

Drive 20-40% of your revenue with Avada
avada email marketing

You want to create a content hub on your website, and you want to add the published date on each article so that you can track the information. Liquid in Shopify will help you to solve your problem. The tutorial today will guide you to format date and convert to a new format.

Table of content

General information to Liquid

Liquid has been used since 2006 and received a lot of positive feedbacks from website developers. Liquid is the backbone of any Shopify platform. As a result, features of Liquid can be utilized easily.

There are three different types in Liquid codes which are objects, tags, and filters. Objects are used to show the content’s location on a page. Double curly braces denote objects and variable names. Filters change the output of a Liquid object. Tags create logic and control flow for a template. Tags begin with two curly braces and percent signs. Tags can be divided into three types: control flow, iteration, and variable assignment.

Date filter belongs to additional filters which support other functions of Liquid.

What is date filter

Like mentioned earlier, the date filter is one of many additional filters that you can use to upload various types of dynamic content. Data filter helps to convert a timestamp into another date format. Date format will appear on your website when you use date filter; hence, you are easy to track the published date of each blog post.

How to format date and convert to new format

You produce date format if following this sample below.

Input


{{ article.published_at | date: "%a, %b %d, %y" }}\

Output


Tue, Apr 22, 14

Conclusion

In conclusion, the data filter helps you to produce date format and convert the timestamp into the date format. Thanks to the data filter, you are able to keep track of public articles. We hope that the tutorial is helpful and let us know your difficulties, we will address them.


Sam Nguyen is the CEO and founder of Avada Commerce, an e-commerce solution provider headquartered in Singapore. He is an expert on the Shopify e-commerce platform for online stores and retail point-of-sale systems. Sam loves talking about e-commerce and he aims to help over a million online businesses grow and thrive.

Stay in the know

Get special offers on the latest news from AVADA.