Format date in Shopware 6 email templates

I could not find the information so this might be useful to someone. Shopware 6 uses twig templating system, therefore you can format dates as you wish very easily.

By default the order confirmation email template uses

order.orderDateTime|date

This will output the date as follow February 10, 2021 16:56 And that might not be the desired format. Therefore it can easily be formatted differently by passing a parameter to the function:

order.orderDateTime|date("d.m.Y")

This will format the date as follow 10.02.2021. The date method accepts works mostly like the PHP date method, so you can pass a second argument such as the time zone.

--

--

Tech Lead/Software engineer. I am currently working on Legal Technologies and Computational Law. I enjoy opera, philosophy nature and literature.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Samuel Pouyt

Tech Lead/Software engineer. I am currently working on Legal Technologies and Computational Law. I enjoy opera, philosophy nature and literature.