Thursday, November 13, 2025
HomeLanguagesPHP | IntlCalendar inDaylightTime() Function

PHP | IntlCalendar inDaylightTime() Function

The IntlCalendar::inDaylightTime() function is an inbuilt function in PHP which is used to check whether the object time is in Daylight Savings Time or not.

Syntax:

  • Object oriented style
    bool public IntlCalendar::inDaylightTime( void )
  • Procedural style
    bool intlcal_in_daylight_time( IntlCalendar $cal )

Parameters: This function accepts single parameter $cal which hold the resource of IntlCalendar object.

Return Value: This function returns TRUE if the date is in Daylight Savings Time and FALSE otherwise.

Below program illustrates the IntlCalendar::inDaylightTime() function in PHP:

Program:




<?php
  
// Set the DateTime zone
ini_set('date.timezone', 'Europe/Lisbon');
  
// Create an instance of IntlCalendar
$calendar = IntlCalendar::createInstance('Europe/Lisbon');
  
// Check whether the object time is in
// Daylight Savings Time or not
var_dump($calendar->inDaylightTime());
  
// Set the month field of IntlCalendar
$calendar->set(IntlCalendar::FIELD_MONTH, 11);
  
// Check whether the object time is in
// Daylight Savings Time or not
var_dump($calendar->inDaylightTime());
  
// Declare a IntlGregorianCalendar object
$calendar = new IntlGregorianCalendar(2019, 8, 24, 12, 40, 10);
  
// Check whether the object time is in
// Daylight Savings Time or not
var_dump($calendar->inDaylightTime());
  
// Set the date to DateTime object
$calendar->set(2019, 8, 24);
  
// Check whether the object time is in
// Daylight Savings Time or not
var_dump($calendar->inDaylightTime());
  
?>


Output:

bool(true)
bool(false)
bool(true)
bool(true)

Reference: https://www.php.net/manual/en/intlcalendar.indaylighttime.php

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
RELATED ARTICLES

Most Popular

Dominic
32399 POSTS0 COMMENTS
Milvus
95 POSTS0 COMMENTS
Nango Kala
6765 POSTS0 COMMENTS
Nicole Veronica
11916 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11983 POSTS0 COMMENTS
Shaida Kate Naidoo
6889 POSTS0 COMMENTS
Ted Musemwa
7141 POSTS0 COMMENTS
Thapelo Manthata
6835 POSTS0 COMMENTS
Umr Jansen
6838 POSTS0 COMMENTS