Symfony/Twig: DB Timezone UTC to CET in Twig

I am really struggling to understand the following:

The setup:
The Database runs in UTC. The user’s TimeZone is CET. And I want to take the UTC datetime from the database, convert it to CET and show it.

The problem:
I want to load a date that is stored as ‘2019-12-14 08:32:17’ in the database as UTC. Now I want to convert it to CET. But if I do that, it looks like Twig assumes the date is already CET and changes nothing. How do I make twig load the date as UTC so that the filter …|date(“d.m.Y H:i”, “Europe/Berlin”) has an effect?
Here’s some examples what my outputs in twig are:
a table of the different outputs I get

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *