The date_timezone_set() function sets the time zone for the DateTime object. It returns NULL on success or FALSE on failure.
Syntax
date_timezone_set(obj, timezone)
Parameters
obj − Specifies a DateTime object.
timezone − Specifies a DateTimeZone object representing the desired time zone.
Return
The date_timezone_set() function returns NULL on success or FALSE on failure.
Example
The following is an example −
<?php $dt = date_create("2018-09-30",timezone_open("America/Chicago")); date_timezone_set($dt,timezone_open("America/Antigua")); echo date_format($dt,"Y-m-d H:i:sP"); ?>
Output
The following is the output −
2018-09-30 01:00:00-04:00