Return to default time zone setting default time zone
PHP Date_default_timezone_get () function
PHP date/time function
Definitions and usage
The Date_default_timezone_get () function returns the default time zone used by all date-time functions in the script.
Grammar
Date_default_timezone_get (void) parameter description
void Optional.
Description
This function returns the default time zone, using the following "assumed" order:
Time zone set with the Date_default_timezone_set () function (if set)
TZ environment variable (if not null)
Date.timezone configuration options (if set)
Speculate on your own (if the operating system supports)
Return UTC If none of the above selections are successful
Example
<?php Tutorial
Echo (Date_default_timezone_get ());
?> output:
Europe/paris
PHP Date_default_timezone_set () function
PHP date/time function
Definitions and usage
The Date_default_timezone_set () function sets the default time zone for all date/time functions in the script.
Grammar
Date_default_timezone_set (timezone) parameter description
TimeZone required. The time zone identifier, such as "UTC" or "Europe/paris".
Description
Note: Since PHP 5.1.0 (This version of the date time function is rewritten), if the time zone is not correct each call to a datetime function generates a E_notice level error message, and e_strict level information is generated if you use system settings or TZ environment variables.
Example
<?php
Echo (Date_default_timezone_set ("Europe/paris"));
?> output:
1