DateTimeInterface::getTimezone

DateTimeImmutable::getTimezone

DateTime::getTimezone

date_timezone_get

Return time zone relative to given DateTime

&reftitle.description;

&style.oop;

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

&style.procedural;

``DateTimeZone``false```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 DateTimeImmutable(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`