How can I change the date format on my overall blog view?

Hi there,

I would like to change the US date format to a Dutch one. So I’ve managed to change the date in the seperate blog articles. By changing the code to:

date: ‘%d %B %Y’ | replace: ‘January’, ‘januari’ | replace: ‘February’, ‘februari’ | replace: ‘March’, ‘maart’ | replace: ‘April’, ‘april’ | replace: ‘May’, ‘mei’ | replace: ‘June’, ‘juni’ | replace: ‘July’, ‘juli’ | replace: ‘August’, ‘augustus’ | replace: ‘September’, ‘september’ | replace: ‘October’, ‘oktober’ | replace: ‘November’, ‘november’ | replace: ‘December’, ‘december’

But I can’t seem to change this the same way for the overall blog page. I’ve tried several things within blog-template.liquid but nothing is working so far. i would greatly appreciate any advice.

Hi @daisyweber ,

You don’t need to add replace for it, you just need to change the code, it will work fine.

{{ article.published_at | time_tag: format: ‘date’ }}

It will automatically translate date’s language.

Or if you want to format it, refer https://www.shopify.com/partners/blog/liquid-date-format , go to ‘Creating localized date formats’

Hope it helps!

1 Like

@LitExtension Thanks! But that’s for the seperate articles. I’m now in ‘en.default.jason’ but I still don’t understand how to change the date format for the overall blog page /news section. I’ve added

"date_formats": {
  "day_month_year": "%d %B %Y'",
  "day_month": "%d %B"

But that doesn’t do anything…

Hi @daisyweber ,

After you add the code in the ‘en.default.json’ file, you need to change the display code as follows:

{{ article.published_at | date: format: ‘month_day_year’ }}

Hope it is clear to you.

Hi @daisyweber ,

If it helped you solve your issue, please mark it as a solution. Thank you and good luck.

1 Like