DateTime::setTimezone

PHP 5 >= 5.2.0, PHP 7, PHP 8
DateTime::setTimezone - Sets the time zone for the DateTime object
Manual
Code Examples

DateTime::setTimezone( DateTimeZone$timezone ): public DateTime

Procedural style

DateTimedate_timezone_set DateTimeobject DateTimeZonetimezone

Parameters

object

Procedural style only: A DateTime object returned by date_create. The function modifies this object.

timezone

A DateTimeZone object representing the desired time zone.

Return Values

Returns the DateTime object for method chaining.

Related Functions

Example of DateTime::setTimezone

Show all examples for DateTime::setTimezone

PHP Version:


Function DateTime::setTimezone:

Date and Time Functions

Most used PHP functions