DateTimeImmutable::setTimezone
Sets the time zone
&reftitle.description;
public DateTimeImmutableDateTimeImmutable::setTimezone
DateTimeZonetimezone
Returns a new DateTimeImmutable object with a new timezone set.
&reftitle.parameters;
timezone
A DateTimeZone object representing the
desired time zone.
&reftitle.returnvalues;
Returns a new modified DateTimeImmutable object for
method chaining. The underlaying point-in-time is not changed when calling
this method.
&reftitle.examples;
DateTimeImmutable::setTimeZone example
&style.oop;
format('Y-m-d H:i:sP') . "\n";
$newDate = $date->setTimezone(new DateTimeZone('Pacific/Chatham'));
echo $newDate->format('Y-m-d H:i:sP') . "\n";
?>
]]>
&examples.outputs;
&reftitle.seealso;
DateTimeImmutable::getTimezone
DateTimeZone::__construct