mentalist Posted April 22, 2015 Share Posted April 22, 2015 What is the best method for managing timezones? Is there a PHP function for retrieving a list of? or should I build a list from the data contained in this download ftp://ftp.iana.org/tz/releases/tzdata2014b.tar.gz from this page http://en.wikipedia.org/wiki/List_of_tz_database_time_zones On php.net I only seem to be able to find how to list the regions and countries but not the offsets, e.g. $timezone_identifiers = DateTimeZone::listIdentifiers(); for ($i=0; $i < 5; $i++) { echo "$timezone_identifiers[$i]\n"; } Many thanks Quote Link to comment https://forums.phpfreaks.com/topic/295765-timezones/ Share on other sites More sharing options...
maxxd Posted April 22, 2015 Share Posted April 22, 2015 http://php.net/manual/en/class.datetimezone.php That's not to say it's easy to deal with time zones - in my experience, it's kind of a massive pain in the butt. However, using DateTime and DateTimezone objects does make it a better experience. Quote Link to comment https://forums.phpfreaks.com/topic/295765-timezones/#findComment-1509633 Share on other sites More sharing options...
Solution mentalist Posted April 22, 2015 Author Solution Share Posted April 22, 2015 http://php.net/manual/en/class.datetimezone.php That's not to say it's easy to deal with time zones - in my experience, it's kind of a massive pain in the butt. However, using DateTime and DateTimezone objects does make it a better experience. I was going cyclic looking through that part of the manual, really wasn't too much help. But just found this and is the first example I've tried which didn't produce exceptions http://www.pontikis.net/tip/?id=24 Thanks Quote Link to comment https://forums.phpfreaks.com/topic/295765-timezones/#findComment-1509634 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.