PHP | IntlCalendar get() Function Last Updated : 25 Sep, 2019 Comments Improve Suggest changes Like Article Like Report The IntlCalendar::get() function is an inbuilt function in PHP which is used to get the value for a specific field. Syntax: Object oriented style int IntlCalendar::get( int $field ) Procedural style int intlcal_get( IntlCalendar $cal, int $field ) Parameters: This function uses two parameters as mentioned above and described below: $cal: This parameter holds the resource of IntlCalendar. $field: This parameter holds one of the IntlCalendar date/time field constants. This field contains an integer value lies between 0 to IntlCalendar::FIELD_COUNT. Return Value: This function returns the integer which holds the value of time field. Below program illustrates the IntlCalendar::get() function in PHP: Program: php <?php // Set the DateTime zone ini_set('date.timezone', 'Asia/Calcutta'); // Declare the IntlCalendar class $cls = new ReflectionClass('IntlCalendar'); // Declare an empty array $arr = array(); // Loop for IntlCalendar constants foreach ($cls->getConstants() as $constName => $constVal) { $arr[$constVal] = $constName; } // Create an instance of IntlCalendar $calendar = IntlCalendar::createInstance(); // Display the date object var_dump(IntlDateFormatter::formatObject($calendar)); // Loop to display result foreach ($arr as $constVal => $constName) { echo "Constant Name: " . $constName . "\nConstant Value: " . $calendar->get($constVal) . "\n\n"; } ?> Output: string(25) "Sep 23, 2019, 11:03:29 AM" Constant Name: WALLTIME_LAST Constant Value: 1 Constant Name: WALLTIME_FIRST Constant Value: 2019 Constant Name: WALLTIME_NEXT_VALID Constant Value: 8 Constant Name: DOW_TYPE_WEEKEND_CEASE Constant Value: 39 Constant Name: DOW_WEDNESDAY Constant Value: 4 Constant Name: DOW_THURSDAY Constant Value: 23 Constant Name: DOW_FRIDAY Constant Value: 266 Constant Name: DOW_SATURDAY Constant Value: 2 Constant Name: FIELD_DAY_OF_WEEK_IN_MONTH Constant Value: 4 Constant Name: FIELD_AM_PM Constant Value: 0 Constant Name: FIELD_HOUR Constant Value: 11 Constant Name: FIELD_HOUR_OF_DAY Constant Value: 11 Constant Name: FIELD_MINUTE Constant Value: 3 Constant Name: FIELD_SECOND Constant Value: 29 Constant Name: FIELD_MILLISECOND Constant Value: 939 Constant Name: FIELD_ZONE_OFFSET Constant Value: 19800000 Constant Name: FIELD_DST_OFFSET Constant Value: 0 Constant Name: FIELD_YEAR_WOY Constant Value: 2019 Constant Name: FIELD_DOW_LOCAL Constant Value: 2 Constant Name: FIELD_EXTENDED_YEAR Constant Value: 2019 Constant Name: FIELD_JULIAN_DAY Constant Value: 2458750 Constant Name: FIELD_MILLISECONDS_IN_DAY Constant Value: 39809939 Constant Name: FIELD_IS_LEAP_MONTH Constant Value: 0 Constant Name: FIELD_FIELD_COUNT Constant Value: Reference: https://www.php.net/manual/en/intlcalendar.get.php Create Quiz Comment J jit_t Follow 0 Improve J jit_t Follow 0 Improve Article Tags : Web Technologies PHP PHP-function PHP-Intl Explore BasicsPHP Syntax4 min readPHP Variables5 min readPHP | Functions6 min readPHP Loops4 min readArrayPHP Arrays5 min readPHP Associative Arrays4 min readMultidimensional arrays in PHP5 min readSorting Arrays in PHP4 min readOOPs & InterfacesPHP Classes2 min readPHP | Constructors and Destructors5 min readPHP Access Modifiers4 min readMultiple Inheritance in PHP4 min readMySQL DatabasePHP | MySQL Database Introduction4 min readPHP Database connection2 min readPHP | MySQL ( Creating Database )3 min readPHP | MySQL ( Creating Table )3 min readPHP AdvancePHP Superglobals6 min readPHP | Regular Expressions12 min readPHP Form Handling4 min readPHP File Handling4 min readPHP | Uploading File3 min readPHP Cookies9 min readPHP | Sessions7 min read Like