PHP date_timezone_set() Function

PHP date_timezone_set Function


Definition :

In php date_timezone_set() Function is inbuilt function.PHP date_timezone_set() function is used to sets the time zone for the given DateTime object. It returns the DateTime object on success or False on failure. It accepts two parameters $object and the $timezone.

Syntax

   date_timezone_set(object, timezone)

Parameter
Parameter Description
object Required. Specifies a DateTime object returned by date_create(). This function modifies this object
timezone Required. Specifies a DateTimeZone object that represents the desired time zone.
 

Given below example The date_timezone_set() function sets the time zone for the DateTime object.

Output : 2018-07-20 00:00:00+05:00
              2018-07-20 00:30:00+05:30