(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
IntlCalendar::getRepeatedWallTimeOption — 取得處理重複日光節約時間結束轉換時鐘回撥的策略
物件導向風格
程序式風格
取得目前處理重複日光節約時間結束轉換期間回撥時鐘時所發生的重複牆上時間的策略。預設值為 IntlCalendar::WALLTIME_LAST
。
此函式需要 ICU 4.9 或更高版本。
calendar
一個 IntlCalendar 實例。
IntlCalendar::WALLTIME_FIRST
或 IntlCalendar::WALLTIME_LAST
常數的其中一個。
範例 #1 IntlCalendar::getRepeatedWallTimeOption()
<?php
ini_set('date.timezone', 'Europe/Lisbon');
ini_set('intl.default_locale', 'en_US');
ini_set('intl.error_level', E_WARNING);
// 10 月 27 日 02:00 時,時鐘會往回撥 1 小時,從 GMT+01 變為 GMT+00
$cal = new IntlGregorianCalendar(2013, 9 /* 十月 */, 27, 1, 30);
var_dump($cal->getRepeatedWalltimeOption()); // 0 WALLTIME_LAST
$formatter = IntlDateFormatter::create(
NULL,
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'UTC'
);
var_dump($formatter->format($cal->getTime() / 1000.));
$cal->setRepeatedWalltimeOption(IntlCalendar::WALLTIME_FIRST);
var_dump($cal->getRepeatedWalltimeOption()); // 1 WALLTIME_FIRST
$cal->set(IntlCalendar::FIELD_HOUR_OF_DAY, 1);
var_dump($formatter->format($cal->getTime() / 1000.));
以上範例將輸出
int(0) string(42) "Sunday, October 27, 2013 at 1:30:00 AM GMT" int(1) string(43) "Sunday, October 27, 2013 at 12:30:00 AM GMT"