PHP date_default_timezone_get() Function

Example

Returns the default time zone:

<?php
echo date_default_timezone_get();;
?>

Running Instance

Definition and Usage

The date_default_timezone_get() function returns the default time zone used by all date/time functions in the script.

Syntax

date_default_timezone_get();

Technical Details

Return Value: Returns the time zone as a string.
PHP Version: 5.1+
Update Log: Starting from PHP 5.4+, time zones are no longer obtained from the operating system, and the TZ variable is no longer used.