0

My understanding was:

  • everything is UTC internally
  • dates are displayed in @@session.time_zone timezone for current session
  • if I do INSERT with +02:00 TZ set and insert 2015-05-15 10:54 it is parsed and stored as 2015-05-15 08:54 UTC.
  • when I change to UTC TZ it should now display 2015-05-15 08:54
  • what happens instead is that it still displays 2015-05-15 10:54

What am I doing wrong? Or is this expected? I read quite some articles about datetime in MySQL but I am still not sure.

  • What exactly do you change to UTC at step 4? – Kondybas May 15 '15 at 9:24
  • The DB has Etc/UTC (time zone is set to SYSTEM and system has Etc/UTC) by default so I connect again (without setting @@session.time_zone). – Tomáš Fejfar May 15 '15 at 11:34
2

That only applies to TIMESTAMP fields. DATETIME fields are left as-is.

See http://dev.mysql.com/doc/refman/5.7/en/datetime.html

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.