I was checking the 'timezone' column of the 'mdl_user' table on an old Moodle site, and found the following values:
The first two are valid formats supported by PHP: http://php.net/manual/en/timezones.php. All new values get saved to that format.
Also I was able to find out that Moodle uses "99" internally to signify the server's default timezone.
Can someone however tell, what the values "1.0" and "2.0" are, and how they've ended up in the table? (There are LOTS of them.)
I'm using Moodle 3.1.6.
I looked at one of the values on profile editing page, and it confirms that they indeed represent the difference to UTC:
So now the question is, why haven't the old values been converted to the new format.
I will report this to the Moodle issue tracker.
I found some existing issues. Here are the most relevant ones:
- https://tracker.moodle.org/browse/MDL-49684 - Replace custom Moodle timezone stuff with standard PHP date/time code
- https://tracker.moodle.org/browse/MDL-50704 - Users UTC+/- timezone settings not migrated to new timezone format
From the latter I found this comment:
All the old numerics and the Etc/GMT ones are considered legacy (only used for calculations) at all effects, not only by us by PHP itself (ref. http://php.net/manual/en/timezones.others.php). And that's what we tried to do with the table above, not automatic migration to any UTC anymore, just guarantee calculations till the user picks a good one.
So apparently the old formats have been left to the database deliberately. I don't really understand why they haven't been migrated, but I'm happy just to know that the data apparently isn't broken despite still using the old formats.
Ah, of course! That's it. I didn't think that far.
I suppose theoretically some timezone names could be deduced from the value of the user's country field, but it wouldn't be very reliable.
Additionally some countries have more than one timezone, so it wouldn't be possible to deduce it right even if the user's country is known.