date_default_timezone_set

Sets the default timezone used by all date/time functions in a script

Syntax

date_default_timezone_set ( string $timezone_identifier ) : bool

Parameters

timezone_identifier

The timezone identifier, like UTC or Europe/Lisbon. The list of valid identifiers is available in the List of Supported Timezones.

Return

This function returns FALSE if the timezone_identifier isn't valid, or TRUE otherwise.

Examples

timezone_identifier

<?

$timezone_identifier = "America/Los_Angeles";

date_default_timezone_set($timezone_identifier);

echo date_default_timezone_get();

?>
America/Los_Angeles

Return

<?

$timezone_identifier = "America/Los_Angeles";

$return = date_default_timezone_set($timezone_identifier);

var_export($return);

?>
true

PHP

Home Menu