Return a new datetime (or timeval) object with new time zone information. Note that the proper time does not change, only the time zone will change.

See time_zones_info() for a list of all available time zones.

If zone information is given using a fixed offset (+hh[mm] or -hh[mm]), then the new datetime object has no proper time zone information and thus has no day-light-saving information.

This function does not generate an event.



Argument Type Description
zone str (required) May be a time zone like Europe/Amsterdam, UTC or the format +hh[mm] / -hh[mm].

Return value

Returns a new datetime (or timeval) object.


This code uses to() as an example:


Return value in JSON format