Jump to content

Timezones


Go to solution Solved by mentalist,

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/295765-timezones/
Share on other sites

  • Solution

 

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 :D

 

http://www.pontikis.net/tip/?id=24

 

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/295765-timezones/#findComment-1509634
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.