首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

IntlCalendar::getTimeZone

(PHP 5.5.0, PHP 7, PECL >= 3.0.0a1)

IntlCalendar::getTimeZone — Get the object?s timezone

Description

Object oriented style

代码语言:javascript
复制
public IntlTimeZone IntlCalendar::getTimeZone ( void )

Procedural style

代码语言:javascript
复制
IntlTimeZone intlcal_get_time_zone ( IntlCalendar $cal )

Returns the IntlTimeZone object associated with this calendar.

Parameters

cal

The IntlCalendar resource.

Return Values

An IntlTimeZone object corresponding to the one used internally in this object.

Examples

Example #1 IntlCalendar::getTimeZone()

代码语言:javascript
复制
<?php
ini_set('date.timezone',?'Europe/Lisbon');
ini_set('intl.default_locale',?'en_US');

$cal?=?IntlCalendar::createInstance();
print_r($cal->getTimeZone());

$cal->setTimeZone('UTC');
print_r($cal->getTimeZone());

$cal?=?IntlCalendar::fromDateTime('2012-01-01?00:00:00?GMT+03:33');
print_r($cal->getTimeZone());

The above example will output:

代码语言:javascript
复制
IntlTimeZone Object
(
    [valid] => 1
    [id] => Europe/Lisbon
    [rawOffset] => 0
    [currentOffset] => 3600000
)
IntlTimeZone Object
(
    [valid] => 1
    [id] => UTC
    [rawOffset] => 0
    [currentOffset] => 0
)
IntlTimeZone Object
(
    [valid] => 1
    [id] => GMT+03:33
    [rawOffset] => 12780000
    [currentOffset] => 12780000
)

See Also

  • IntlCalendar::setTimeZone() - Set the timezone used by this calendar
  • IntlCalendar::createInstance() - Create a new IntlCalendar
  • IntlGregorianCalendar::__construct()

← IntlCalendar::getTime

IntlCalendar::getType →

代码语言:txt
复制
 ? 1997–2017 The PHP Documentation Group

Licensed under the Creative Commons Attribution License v3.0 or later.

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com