Liquid date filter not working

I’m trying to have a custom date but the filter doesn’t work!
Example filter:

{{ site.time | date: “%Y” }}

Example output: 2024-05-05 20:20:03 +0300
What am I doing wrong?

It looks like the quotes around %Y are “fancy quotes”, rather than plain quotation marks. Liquid only works with plain quotation marks. Compare the difference:

{{ site.time | date: “%Y” }}
{{ site.time | date: "%Y" }}

Possibly the fancy-quotes were automatically generated by your text editor.

1 Like

It works! Thank you so so much, I wouldn’t have noticed it otherwise.