0

everything that I have read about timestamp and datetime in mysql suggests that it is not possible to find out the timezone of a datetime - Field in mysql.

If that is true, isn't that a big advantage of timestamp - values compared to datetime - values?

For example if by mistake the default-time-zone is changed and there are stored some datetime-values with

now()

you will have a hard time to fix the wrong values. Whereas with timestamp you can just set the timezone you want to have and the database changes the entries automaticly because it stores them always in UTC.

Matthias Gwiozda
  • 505
  • 5
  • 14

1 Answers1

2

is it possible to get the timezone of a datetime - field?

No, you cannot get timezone info from the DateTime column because it doesn't have such information.
Perhaps, the system or server timezone is what you are looking for.

isn't that a big advantage of timestamp - values compared to datetime - values?

It depends on the context. Use a suitable data type for columns. Not always you need to change the presentation of date+time if your server moved to another location. Rather, on the contrary, once stored data must remain unchanged in most cases.

See:

artoodetoo
  • 918
  • 10
  • 55