+813-444-3589+44 118 328 3220+49-231-976765-0 | Contact us

Date/Time Filters

These filter convert a date/time value to a string. If you have a DateTime object (which denotes a specific point in time), you should use the date filter. If you have an int with seconds (e.g. runtime of a movie), you should use the time or time_minutes filter.

date

The date filter formats a given DateTime object to a string, depending on the parameter specified, which contains the format layout. Instead of using a DateTime object, you could also use either the string ‘now’ or ‘today’ in order to use the current time (e.g. {{ ‘now’ | date: ‘%Y’ }} will output the current year). The format string could contain one or more placeholders, you can combine them in any order as you like. A placeholder always starts with a percent character followed by a character (which is case sensitive). The date format will be localized depending on the country from where the user visits the shop. The following placeholders can be used:

Place holder Description  
%a

Weekday (abbreviated).

{{ product.release_date | date: '%a' }}

Fri (USA)

Fr (Germany)

 

%A

Weekday (full).

{{ product.release_date | date: '%A' }}

Friday (USA)

Freitag (Germany)

 

%b

Name of the month (abbreviated).

{{ product.release_date | date: '%b' }}

Jul (USA)

Jul (Germany)

 

%B

Name of the month (full).

{{ product.release_date | date: '%B' }}

July (USA)

Juli (Germany)

 

%c

Preferred short date & time.

{{ product.release_date | date: '%c' }}

7/11/2008 2:16 PM (USA)

11.07.2008 14:16 (Germany)

 

%C

Preferred long date & time.

Friday, July 11, 2008 2:16 PM (USA)

Freitag, 11. Juli 2008 14:16 (Germany)

EF

%d

Day of the month (01-31) (always two digit formatting).

{{ product.release_date | date: '%d' }}

11 (USA)

11 (Germany)

 

%e

Day of the month ( 1-31) (formatted with a leading whitespace if the number is less than 10).

{{ product.release_date | date: '%e' }}

11 (USA)

11 (Germany)

 

%H

Hour based on 24-hour-clock (00-23).

{{ product.release_date | date: '%H' }}

14 (USA)

14 (Germany)

 

%I

Hour based on 12-hour-clock (01-12).

{{ product.release_date | date: '%I' }}

02 (USA)

02 (Germany)

 

%j

The day of year (1-366) (padded with zeros).

{{ product.release_date | date: '%j' }}

193 (USA)

193 (Germany)

 

%m

Month (01-12).

{{ product.release_date | date: '%m' }}

07 (USA)

07 (Germany)

 

%M

Minute (00-59).

{{ product.release_date | date: '%M' }}

16 (USA)

16 (Germany)

 

%p

The AM/PM designator (if applicable, otherwise an empty string).

{{ product.release_date | date: '%p' }}

PM (USA)

(Germany)

 

%S

Second (00-59).

{{ product.release_date | date: '%S' }}

26 (USA)

26 (Germany)

 

%U

Week of the year (with week starting on Sunday) (01-53)

{{ product.release_date | date: '%U' }}

28 (USA)

28 (Germany)

 

%w

Day of the week (0-6, 0 = Sunday).

{{ product.release_date | date: '%w' }}

5 (USA)

5 (Germany)

 

%W

Week of the year (with week starting on Monday) (01-53)

{{ product.release_date | date: '%W' }}

28 (USA)

28 (Germany)

 

%x

Preferred short date format.

{{ product.release_date | date: '%x' }}

7/11/2008 (USA)

11.07.2008 (Germany)

 

%X

Preferred short time format.

{{ product.release_date | date: '%X' }}

2:16:26 PM (USA)

14:16:26 (Germany)

 

%y

Year (last two digits).

{{ product.release_date | date: '%y' }}

08 (USA)

08 (Germany)

 

%Y

Year.

{{ product.release_date | date: '%Y' }}

2008 (USA)

2008 (Germany)

 

%Z

Time zone (Hours and minutes offset from UTC). Time stamps are stored always as german time, therefore this will resemble most often around +1/+2 UTC).

{{ product.release_date | date: '%Z' }}

+02:00 (USA)

+02:00 (Germany)

 

%%

As % is a reserved character for a placeholder, you need to use a double % in order to show the % character as a result.

{{ product.release_date | date: '%%' }}

% (USA)

% (Germany)

 

 

Example:


{{ product.release_date | date: '%Y-%m-%d' }}
		

 

Output:


2008-07-11
		

 

time

This filter will format a given number of seconds to a time string of format M:SS.

Example:


{{ 189 | time }}
		

 

Output:


3:09
		

Note: This filter is exclusive to FlickRocket. If you are using a theme orginating from Shopify and want to use this filter, you need to add this.

 

time_minutes

Formats a given number of seconds to a (rounded) minute string.

Example:


{{ 189 | time_minutes }}
		

 

Output:


3
		

Note: This filter is exclusive to FlickRocket. If you are using a theme orginating from Shopify and want to use this filter, you need to add this.