Добро пожаловать на форум PHP программистов!
За последние 24 часа нас посетили 21956 программистов и 985 роботов. Сейчас ищет 681 программист ...
Приступая к работе

IntlDateFormatter::getTimeZone - Get formatterʼs timezone

Вернуться к: IntlDateFormatter

IntlDateFormatter::getTimeZone

datefmt_get_timezone

(PHP 5 >= 5.5.0, PHP 7, PECL intl >= 3.0.0)

IntlDateFormatter::getTimeZone -- datefmt_get_timezoneGet formatterʼs timezone

Описание

Объектно-ориентированный стиль

public IntlTimeZone IntlDateFormatter::getTimeZone ( void )

Процедурный стиль

IntlTimeZone datefmt_get_timezone ( void )

Returns an IntlTimeZone object representing the timezone that will be used by this object to format dates and times. When formatting IntlCalendar and DateTime objects with this IntlDateFormatter, the timezone used will be the one returned by this method, not the one associated with the objects being formatted.

Список параметров

У этой функции нет параметров.

Возвращаемые значения

The associated IntlTimeZone object или FALSE в случае возникновения ошибки.

Примеры

Пример #1 IntlDateFormatter::getTimeZone() examples

<?php

$madrid 
IntlDateFormatter::create(NULLNULLNULL'Europe/Madrid');
$lisbon IntlDateFormatter::create(NULLNULLNULL'Europe/Lisbon');

var_dump($madrid->getTimezone());
echo 
$madrid->getTimezone()->getDisplayName(
        
falseIntlTimeZone::DISPLAY_GENERIC_LOCATION"en_US"), "\n";
echo 
$lisbon->getTimeZone()->getId(), "\n";
//The id can also be retrieved with ->getTimezoneId()
echo $lisbon->getTimeZoneId(), "\n";

Результат выполнения данного примера:

object(IntlTimeZone)#4 (4) {
  ["valid"]=>
  bool(true)
  ["id"]=>
  string(13) "Europe/Madrid"
  ["rawOffset"]=>
  int(3600000)
  ["currentOffset"]=>
  int(7200000)
}
Spain Time
Europe/Lisbon
Europe/Lisbon

Смотрите также



Вернуться к: IntlDateFormatter

© 2024 «PHP.RU — Сообщество PHP-Программистов»
Главная | Форум | Реклама на сайте | Контакты VIP Сувениры
Разработка компании ODware