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.