|
DateTime::setTimezonedate_timezone_setSets the time zone for the DateTime object DescriptionObject-oriented style
public DateTime DateTime::setTimezone(DateTimeZone
$timezone )Procedural style DateTime date_timezone_set(DateTime
$object , DateTimeZone $timezone )Sets a new timezone for a DateTime object. Like DateTimeImmutable::setTimezone but works with DateTime. The procedural version takes the DateTime object as its first argument. Parameters
Return ValuesReturns the DateTime object for method chaining. The underlaying point-in-time is not changed when calling this method. ExamplesExample #1 DateTime::setTimeZone example Object-oriented style
Procedural style
The above examples will output: 2000-01-01 00:00:00+12:00 2000-01-01 01:45:00+13:45 See Also
|