PHP date_default_timezone_set() Function
Definition
The date_default_timezone_set() function sets the default timezone used by date/time functions.
Syntax
PHP date_default_timezone_set() Function has the following syntax.
date_default_timezone_set(timezone);
Parameter
- timezone - Required. Timezone to use, like "UTC" or "Europe/Paris".
Return
PHP date_default_timezone_set() Function returns FALSE if the timezone is not valid. TRUE otherwise.
Example
Set the default timezone:
<?php
date_default_timezone_set("Asia/Bangkok");
echo date_default_timezone_get();
?>
The code above generates the following result.