PHP | IntlCalendar get() Function Last Updated : 25 Sep, 2019 Summarize Comments Improve Suggest changes Share 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 Comment More infoAdvertise with us Next Article PHP | IntlCalendar getErrorCode() Function J jit_t Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Intl Similar Reads PHP | IntlCalendar getTime() Function The IntlCalendar::getTime() function is an inbuilt function in PHP which is used to return the time currently represented by the object. The time is expressed in terms of milliseconds since the epoch. Syntax: Object oriented style float IntlCalendar::getTime( void ) Procedural style float intlcal_ge 1 min read PHP | IntlCalendar getType() Function The IntlCalendar::getType() function is an inbuilt function in PHP which is used to get the calendar type in terms of string. The "calendar" is the valid value of keywords. Syntax: Object oriented stylestring IntlCalendar::getType( void )Procedural stylestring intlcal_get_type( IntlCalendar $cal ) P 1 min read PHP | IntlCalendar getTimeZone() Function The IntlCalendar::getTimeZone() function is an inbuilt function in PHP which is used to return the timezone object associated with this calendar. Syntax: Object oriented style IntlTimeZone IntlCalendar::getTimeZone( void ) Procedural style IntlTimeZone intlcal_get_time_zone( IntlCalendar $cal ) Para 2 min read PHP | IntlCalendar getErrorCode() Function The IntlCalendar::getErrorCode() function is an inbuilt function in PHP which returns the numeric ICU error code for the last call on this object or the IntlCalendar given for the calendar parameter. This function can indicate a warning message (negative error code) or no error. Syntax: Object orien 1 min read PHP | IntlCalendar set() Function The IntlCalendar::set() function is an inbuilt function in PHP which is used to set the time field or several common fields at once. The range of field value depends on the calendar. This function can not be called with exactly four parameters. Syntax: Object oriented style bool IntlCalendar::set( i 2 min read PHP | IntlCalendar add() Function The IntlCalendar::add() function is an inbuilt function in PHP which is used to add a signed amount of time to a field. Syntax: Object oriented style: bool IntlCalendar::add( int $field, int $amount ) Procedural style: bool intlcal_add( IntlCalendar $cal, int $field, int $amount ) Parameters: $cal: 2 min read Like