1

My app has to deal with time zones (fun!). To that end I have decided that in the DB everything will be UTC. For all to work well I need to set the connection timezone:

SET time_zone='UTC';

There's just one problem - MariaDB comes by default without data in the time zone table, so the above line fails. I can instead use:

SET time_zone='+00:00';

Which should do the same... but does it really? Perhaps there is some weird corner case where the two are not the same and which will come back to haunt me? I can't think of anything, but... I'd like to double-check.

Vilx-
  • 104,512
  • 87
  • 279
  • 422
  • I'm talking from memory but in the context of MySQL (MariaDB should be similar) named time zones are only required to handle _changes_ in time zone rules (e.g. DST) and don't really accomplish anything else. You know the deal: with `Europe/Madrid` you can figure out whether it's `+01:00` or `+02:00` depending on the date. Nice question anyway. – Álvaro González Apr 12 '19 at 08:31
  • Somewhere there are instructions on loading the TZ table(s). – Rick James May 12 '19 at 15:41

3 Answers3

3

Hi yes UTC is the same as +00:00 as both will have no daylight savings changes as they're region-free.

2

If you insist on a corner case. :-) The offset, such as +00;00, could be an offset from either GMT or UTC. So in theory it might not be exactly the same as UTC. However, in theory there is never more than 1 second between the two, and in practice I have still to hear of any computer that makes any distinction between the two at all.

So I’d be happy with your second version

SET time_zone='+00:00';

Link: Difference between UTC and GMT

Ole V.V.
  • 81,772
  • 15
  • 137
  • 161
0

UTC is in all cases that I know of the reference time, meaning it's +00:00.

Every sites agree on that, you could try to look at sites like this one: https://24timezones.com/time-zone/utc , which indicate the time difference to UTC (+00).

night-gold
  • 2,202
  • 2
  • 20
  • 31