Jump to content

DateTimeZone::listIdentifiers headache


2levelsabove

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.