PHP | IntlCalendar inDaylightTime() Function
Last Updated :
25 Sep, 2019
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:
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
ini_set ( 'date.timezone' , 'Europe/Lisbon' );
$calendar = IntlCalendar::createInstance( 'Europe/Lisbon' );
var_dump( $calendar ->inDaylightTime());
$calendar ->set(IntlCalendar::FIELD_MONTH, 11);
var_dump( $calendar ->inDaylightTime());
$calendar = new IntlGregorianCalendar(2019, 8, 24, 12, 40, 10);
var_dump( $calendar ->inDaylightTime());
$calendar ->set(2019, 8, 24);
var_dump( $calendar ->inDaylightTime());
?>
|
Output:
bool(true)
bool(false)
bool(true)
bool(true)
Reference: https://www.php.net/manual/en/intlcalendar.indaylighttime.php
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...