Why is timezone changed upon DB save? [duplicate]

I create a datetime object in php like this

$now = new DateTime("now", new DateTimeZone("UTC"));

A dump verifies that the data is timezone UTC:

EntryController.php on line 197:
DateTime @1607184913 {#849 ▼
  date: 2020-12-05 16:15:13.939511 UTC (+00:00)

I save it to my DB in symfony like this


And when I look at it in phpmyadmin I see that the date is stored as my current timezone (+1). Anybody know Why?

I have obviously left code out since it is hardly relevant for the problem. The exact time in my sample DB entry and the time variable dumped are not identical, but they illustrate my problem.

enter image description here

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

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