I'm trying to integrate PHP's date time and timezone features into my applications. What I have working now:
- Every time is stored in the database as a Unix timestamp
- Every time manipulation is all done using the timestamp
- The only time it exists as a user-friendly format is right when it is displayed to the user
Yes, I know MySQL has an internal date time primitive object, but I don't fully understand how it works, and it just seems like a pain storing time in that format.
I also wrote my own very simple timezone library, consisting of literal (-12, 11) hour offsets with some friendly name assigned to each of the offsets. This is supposed to be changed later on to a full fledged timezone library, because I know the pains of creating a new timezone library (https://www.youtube.com/watch?v=-5wpm-gesOY). I have tried PHP's internal timezone library and everything seems to work perfectly.
There is a canonical list of timezones provided by PHP that can be accessed at DateTimeZone::listIdentifiers()
. I sort of expect PHP itself will communicate with some outside time keeping database to change the timezones dynamically if any country changes its timezone details. My question is, does this actually happen? If it does happen, is there any guarantee that a specific timezone (say America/Guatemala
) will still be recognized by PHP over time and not throw an error when timezones change?