2levelsabove Posted January 29, 2010 Share Posted January 29, 2010 http://php.net/manual/en/datetimezone.listidentifiers.php So the documentation states that one can get locales by using the above mentioned function. However what I am trying to do is get country specific data. I am using: $timezone_identifiers = DateTimeZone::listIdentifiers(4096,"CN"); print_r($timezone_identifiers); and I still get the whole list!. All I want is the locales per country, in this case china. What am I doing wrong? Link to comment https://forums.phpfreaks.com/topic/190206-datetimezonelistidentifiers-headache/ Share on other sites More sharing options...
trq Posted January 29, 2010 Share Posted January 29, 2010 $timezone_identifiers = DateTimeZone::listIdentifiers(DateTimeZone::PER_COUNTRY, "CN"); Link to comment https://forums.phpfreaks.com/topic/190206-datetimezonelistidentifiers-headache/#findComment-1003508 Share on other sites More sharing options...
2levelsabove Posted January 29, 2010 Author Share Posted January 29, 2010 Fatal error: Undefined class constant 'PER_COUNTRY' in /home/jinimat/public_html/includes/_process/getTimeZone.php on line 5 Link to comment https://forums.phpfreaks.com/topic/190206-datetimezonelistidentifiers-headache/#findComment-1003512 Share on other sites More sharing options...
trq Posted January 29, 2010 Share Posted January 29, 2010 Sorry, I should've looked up 4096, its the same thing. Doesn't help you though sorry. Link to comment https://forums.phpfreaks.com/topic/190206-datetimezonelistidentifiers-headache/#findComment-1003516 Share on other sites More sharing options...
Genesis730 Posted January 29, 2010 Share Posted January 29, 2010 Are you simply wanting to just echo the time in china?? if so try this <?PHP putenv("TZ=Asia/Shanghai");echo "Time in China: ". date("h:i:s")."\n"; ?> There are more values to set for TZ(timezone) lemme know of a specific country if you can't find it Link to comment https://forums.phpfreaks.com/topic/190206-datetimezonelistidentifiers-headache/#findComment-1003526 Share on other sites More sharing options...
2levelsabove Posted January 29, 2010 Author Share Posted January 29, 2010 I actually have a drop down that allows users to select their country. So it could be any 2 letter country code. However the function appears to have a flaw as it keeps returning all the time zones. Link to comment https://forums.phpfreaks.com/topic/190206-datetimezonelistidentifiers-headache/#findComment-1003527 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.