DateTimeZone::getName

timezone_name_get

(PHP 5 >= 5.2.0)

DateTimeZone::getName -- timezone_name_getReturns the name of the timezone

Description

Object oriented style

public string DateTimeZone::getName ( void )

Procedural style

string timezone_name_get ( DateTimeZone $object )

Returns the name of the timezone.

Parameters

object

The DateTimeZone for which to get a name.

Return Values

One of the timezone names in the list of timezones.

Коментарии

If you construct DateTimeZone from locale name, like "Europe/Moscow", getName() returns named timezone from list.

<?php
$tz 
= new DateTimeZone('Europe/Moscow');
echo 
$tz->getName(); // Europe/Moscow
?>

But if you use offset string, like "+0300", getName() returns new offset string instead of name.

<?php
$tz 
= new DateTimeZone('+0300');
echo 
$tz->getName(); // +03:00
?>

It makes sense, but it's not obvious and not documented there.
2021-10-07 17:31:59
http://php5.kiev.ua/manual/ru/datetimezone.getname.html

    Поддержать сайт на родительском проекте КГБ