PHP | IntlCalendar isWeekend() Function Last Updated : 25 Sep, 2019 Comments Improve Suggest changes Like Article Like Report The IntlCalendar::isWeekend() function is an inbuilt function in PHP which is used to check whether a given date/time is in the weekend or not. Syntax: Object oriented style bool IntlCalendar::isWeekend( float $date = NULL ) Procedural style bool intlcal_is_weekend( IntlCalendar $cal, float $date = NULL ) Parameters: This function uses two parameters as mentioned above and described below: $cal: This parameter holds the resource of IntlCalendar object. $date: This parameter holds the optional timestamp which represents the number of milliseconds since the epoch, excluding leap seconds. If the value of this parameter is NULL then it uses the current time. Return Value: This function returns the Boolean value which represents the given time occurs in a weekend or not. Below program illustrates the IntlCalendar::isWeekend() function in PHP: Program: php <?php // Set the DateTime zone ini_set('date.timezone', 'Asia/Calcutta'); // Create an instance of IntlCalendar $calendar = IntlCalendar::createInstance('Asia/Calcutta'); // Check the given DateTime is weekend or not var_dump($calendar->isWeekend()); // Set the DateTime to the object $calendar->set(2019, 8, 29); // Check the given DateTime is weekend or not var_dump($calendar->isWeekend()); // Set the DateTime object $calendar->isWeekend(strtotime('2019-09-22 12:30:00')); // Check the given DateTime is weekend or not var_dump($calendar->isWeekend()); ?> Output: bool(false) bool(true) bool(true) Reference: https://www.php.net/manual/en/intlcalendar.isweekend.php Comment J jit_t Follow 0 Improve J jit_t Follow 0 Improve Article Tags : Web Technologies PHP PHP-function PHP-Intl Explore PHP Tutorial 8 min read BasicsPHP Syntax 4 min read PHP Variables 5 min read PHP | Functions 8 min read PHP Loops 4 min read ArrayPHP Arrays 5 min read PHP Associative Arrays 4 min read Multidimensional arrays in PHP 5 min read Sorting Arrays in PHP 4 min read OOPs & InterfacesPHP Classes 2 min read PHP | Constructors and Destructors 5 min read PHP Access Modifiers 4 min read Multiple Inheritance in PHP 4 min read MySQL DatabasePHP | MySQL Database Introduction 4 min read PHP Database connection 2 min read PHP | MySQL ( Creating Database ) 3 min read PHP | MySQL ( Creating Table ) 3 min read PHP AdvancePHP Superglobals 6 min read PHP | Regular Expressions 12 min read PHP Form Handling 4 min read PHP File Handling 4 min read PHP | Uploading File 3 min read PHP Cookies 9 min read PHP | Sessions 7 min read Like