PHP 7.4.24 Released!


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

IntlCalendar::inDaylightTimeWhether the objectʼs time is in Daylight Savings Time


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

public IntlCalendar::inDaylightTime(): bool

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

intlcal_in_daylight_time(IntlCalendar $cal): bool

Whether, for the instant represented by this object and for this objectʼs timezone, daylight saving time is in place.

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


The IntlCalendar resource.

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

Returns true if the date is in Daylight Savings Time, false otherwise. The value false may also be returned on failure, for instance after specifying invalid field values on non-lenient mode; use exceptions or query intl_get_error_code() to disambiguate.


Пример #1 IntlCalendar::inDaylightTime()


$cal = new IntlGregorianCalendar(2013/* July */145631);
var_dump($cal->inDaylightTime()); // true
$cal->set(IntlCalendar::FIELD_MONTH11 /* December */);
var_dump($cal->inDaylightTime()); // false

//DST end transition on 2013-10-27 at 0200 (wall time back 1 hour)
$cal = new IntlGregorianCalendar(2013/* October */271300);

var_dump($cal->inDaylightTime()); // false (default WALLTIME_LAST)

$cal->set(IntlCalendar::FIELD_HOUR_OF_DAY1); // force time recalculation
var_dump($cal->inDaylightTime()); // true

add a note add a note

User Contributed Notes

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