DateTime::getTimezone

DateTimeImmutable::getTimezone

DateTimeInterface::getTimezone

date_timezone_get

Return time zone relative to given DateTime

&reftitle.description;

&style.oop;

public `DateTimeZone` `DateTime::getTimezone` public `DateTimeZone` `DateTimeImmutable::getTimezone` public `DateTimeZone` `DateTimeInterface::getTimezone`

&style.procedural;

`DateTimeZone` `date_timezone_get` `DateTimeInterface` `object`

Return time zone relative to given DateTime.

&reftitle.parameters;
&date.datetime.description;
&reftitle.returnvalues;

Returns a `DateTimeZone` object on success &return.falseforfailure;.

&reftitle.examples;

### `DateTime::getTimezone` example

&style.oop;

    <?php
    $date = new DateTime(null, new DateTimeZone('Europe/London'));
    $tz = $date->getTimezone();
    echo $tz->getName();
    ?>

&style.procedural;

    <?php
    $date = date_create(null, timezone_open('Europe/London'));
    $tz = date_timezone_get($date);
    echo timezone_name_get($tz);
    ?>

&examples.outputs;

    Europe/London

&reftitle.seealso;

- `DateTime::setTimezone`