PHP date_default_timezone_set() from GMT offset is possible?
im mySQL db I have:
|timezoneid | gmt_offset | dst_offset | timezone_code | zone_name
| 1 | -12 | 0 | NULL | (GMT-12:00) International Date Line West
I want to be able to set time zones from database
Check the output of DateTimeZone::listAbbreviations()
, it gives you a full list of supported timezones and corresponding offsets. You should check the exact output yourself, since you get nested arrays.
Also note that not all timezones have an exact full hour offset to UTC, some regions add 30 or 45 minutes too.