Symfony, Doctrine – Manage user timezone

By default when you use entity field DateTimeType the date is saved in default timezone configured in your php configuration. Sometimes we need to show and manage dates from database in different timezones.

Using code placed below, date in the database will be saved in UTC +00:00 and during every insert/update data, dates will be converted into this timezone. Every time when you will load data from database, dates will be converted into user defined timezone.

How to do this:

Continue reading Symfony, Doctrine – Manage user timezone