The following examples should work in any jekyll website, shopify or any other cms where used Liquid. Normally in jekyll date function used for the post publication date. Normally it displaying with {{ page.date }}
tag and othe output format of that code is,
2024-10-22 00:00:00 -0500
But if you use the date filter it could be a better format : Example 1 :
{{ page.date | date: '%B %d, %Y' }}
Output Result :
October 22, 2019
There have few built in date filters available in jekyll to show the date to string. Example 2 :
{{ page.date | date_to_string }}
Output Result :
22 Oct 2019
If you want to show the long string then follow this example, Example 3 :
{{ page.date | date_to_long_string }}
Output Result :
22 October 2019
For the XML Schema markup Example 4 :
{{ page.date | date_to_xmlschema }}
Output Result :
2024-10-22T09:14:00-04:00
For the ISO 8601 Date, Example 5 :
{{ page.date | date: "%Y-%m-%d" }}
Output Result :
2024-10-22
For U.S. Numeric Style with Four Digit Years (With leading zeros) Example 6 :
{{ page.date | date: "%m/%d/%Y" }}
Output Result :
10/22/2019
U.S. Numeric Style with Four Digit Years (Leading zeros removed.) Example 7 :
{{ page.date | date: "%-m/%-d/%Y" }}
Output Result :
5/6/2019
U.S. Numeric Style with Two Digit Year (Leading zeros removed) Example 8 :
{{ page.date | date: "%-m/%-d/%y"}}
Output Result :
5/6/19
For Full Month Name (Leading zeros removed.) Example 9 :
{{ page.date | date: "%-d %B %Y"}}
Output Result :
22 October 2019
Outside U.S. Style with Non-English Full Month Name (Leading zeros removed.) Here we are using dutch language for the months. Example 10 :
{% assign m = page.date | date: "%-m" %}
{{ page.date | date: "%-d" }}
{% case m %}
{% when '1' %}januari
{% when '2' %}februari
{% when '3' %}maart
{% when '4' %}April
{% when '5' %}mei
{% when '6' %}Juni
{% when '7' %}Juli
{% when '8' %}augustus
{% when '9' %}September
{% when '10' %}Oktober
{% when '11' %}November
{% when '12' %}december
{% endcase %}
{{ page.date | date: "%Y" }}
Output Result :
22 Oktober 2019
If you want to know more about Jekyll formatting the date then visit our helpful blog support here.