Set the Beijing time function date_default_timezone_set () in the php tutorial ()
Definition and usage
The date_default_timezone_set () function is used to set the default time zone of all date/time functions in the script.
Syntax
Date_default_timezone_set (timezone)
<? Php
$ Now = time ();
Date_default_timezone_set ('America/new york ');
Print date ('C', $ now );
Date_default_timezone_set ('Europe/paris ');
Print date ('C', $ now );
?>
Let's look at another example.
<? Php
Date_default_timezone_set ('America/denver ');
$ Summer = mktime );
Print date ('C', $ summer). "n ";
Date_default_timezone_set ('America/phoenix ');
Print date ('C', $ summer). "n ";
?>
Note: Since php 5.1.0 (this version of the datetime function has been rewritten), if the time zone does not comply with the rules, every call to the datetime function will generate an e_notice-level error message, if you use system settings or tz environment variables, information at the e_strict level will also be generated.
Reference Table
Table h-10. others
Cet cst6cdt cuba eet egypt
Eire est est5edt etc/gmt + 0
Etc/gmt + 1 etc/gmt + 10 etc/gmt + 11 etc/gmt + 12 etc/gmt + 2
Etc/gmt + 3 etc/gmt + 4 etc/gmt + 5 etc/gmt + 6 etc/gmt + 7
Etc/gmt + 8 etc/gmt + 9 etc/gmt-0 etc/gmt-1 etc/gmt-10
Etc/gmt-11 etc/gmt-12 etc/gmt-13 etc/gmt-14 etc/gmt-2 etc/
Etc/gmt-3 etc/gmt-4 etc/gmt-5 etc/gmt-6 etc/gmt-7 etc/
Etc/gmt-8 etc/gmt-9 etc/gmt0 etc/greenwich etc/uct
Etc/universal etc/utc etc/zulu factory gb
Gb-eire gmt + 0 gmt-0 gmt0
Greenwich hongkong hst iceland iran
Israel jamaica japan kwajalein libya
Met mst mst7mdt navajo nz
Nz-chat poland portugal prc pstutorial t8pdt
Roc rok singapore turkey uct
Universal utc w-su wet zulu