Set the time zone of a DateTime object:
<?php$date=date_create("2013-05-25",timezone_open("Indian/Kerguelen"));echo date_format($date,"Ymd H:i:sP");?>date_timezone_set() function DateTime object's time zone.
date_timezone_set( object,timezone);
parameter | describe |
---|---|
object | Required. Specifies a DateTime object returned by date_create(). This function modifies the object. |
timezone | Required. Specifies a DateTimeZone object representing the desired time zone. Tip: See a list of all time zones supported in PHP |
Return value: | Returns a DateTime object in the specified format. Returns FALSE on failure. |
---|---|
PHP version: | 5.2+ |
Update log: | PHP 5.3.0: Return value changed from NULL to DateTime. |