The date_default_timezone_set() function sets the default time zone.
Syntax
date_default_timezone_set(timezone)
Parameters
timezone − The time zone to use, such as "UTC" or "Europe/Paris".
Return
The date_default_timezone_set() function returns FALSE if the timezone is not valid. TRUE otherwise.
Example
The following is an example −
<?php date_default_timezone_set("Asia/Kolkata"); echo date_default_timezone_get(); ?>
Output
Asia/Kolkata
Example
Let us see another example −
<?php date_default_timezone_set('Asia/Singapore'); $obj= date_default_timezone_get(); if (strcmp($obj, ini_get('date.timezone'))){ echo 'No match!'; } else { echo 'Match!'; } ?>
Output
No match!