用于时区的PHP变量

I'm asking about PHP contants for timezones name

For Example :

$rc = date_default_timezone_set("US/Mountain");

"US/Mountain" to be constants not write it as text

is it exist from PHP classes or I need to do it myself

Thanks in advance

There's no such a thing as a predefined constant for this because simply it's not needed. date_default_timezone_set works with a string. If you want a constant then you can define one yourself:

define('MY_CONSTANT', "US/Mountain");

and obviously use it as:

date_default_timezone_set(MY_CONSTANT);

You have to mention the timezone yourself. There are not any inbuilt classes or something else for that..

You can use the information on this page:

http://php.net/manual/en/timezones.php

To build a list of "valid constants" or do whatever you want. Interestingly, on this page:

http://php.net/manual/en/timezones.others.php

It says that you can also do this:

date_default_timezone_set ( "Etc/GMT-8" );

No PHP constants are there to represent particular time zone.You can set ur time zone using

<?php
$timezone = "urtimezone";
if(function_exists('date_default_timezone_set')) date_default_timezone_set($timezone);
echo date('d-m-Y H:i:s');
?>

List of Supported Timezones can be found here