DateTime::getTimezone

DateTimeImmutable::getTimezone

DateTimeInterface::getTimezone

date_timezone_get

(PHP 5 >= 5.2.1, PHP 7)

DateTime::getTimezone -- DateTimeImmutable::getTimezone -- DateTimeInterface::getTimezone -- date_timezone_getReturn time zone relative to given DateTime

Opis

Styl obiektowy

public DateTime::getTimezone ( void ) : DateTimeZone
public DateTimeImmutable::getTimezone ( void ) : DateTimeZone
public DateTimeInterface::getTimezone ( void ) : DateTimeZone

Styl proceduralny

Return time zone relative to given DateTime.

Parametry

object

Tylko styl proceduralny: Obiekt DateTime zwracany przez date_create()

Zwracane wartości

Returns a DateTimeZone object on success lub FALSE w przypadku niepowodzenia.

Przykłady

Przykład #1 DateTime::getTimezone() example

Styl obiektowy

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

Styl proceduralny

<?php
$date 
date_create(nulltimezone_open('Europe/London'));
$tz date_timezone_get($date);
echo 
timezone_name_get($tz);
?>

Powyższe przykłady wyświetlą:

Europe/London

Zobacz też:

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top