Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP date_default_timezone_set() Function

PHP date_default_timezone_set() Function

PHP Date/Time PHP Date/Time Reference Manual

Example

Set the default time zone:

Run Example »


Definition and Usage

The date_default_timezone_set() function sets the default time zone used by all date/time functions in a script.

Syntax

date_default_timezone_set(

timezone

);

Parameters Description
timezone Required. Specifies the time zone to use, such as "UTC" or "Europe/Paris". List of valid time zones: http://www.php.net/manual/en/timezones.php

Technical Details

Return Value: If both the timezone Returns FALSE if invalid, TRUE otherwise.
PHP Version: 5.1+
Changelog: Since PHP 5.1.2+, this function validates the timezone parameter. Since PHP 5.3+, it raises E_WARNING instead of E_STRICT.

PHP Date/Time PHP Date/Time Reference Manual