PHP | IntlDateFormatter getCalendar() Function Last Updated : 27 Jan, 2022 Comments Improve Suggest changes Like Article Like Report The IntlDateFormatter::getCalendar() function is an inbuilt function in PHP which is used to return the calendar type used for the IntlDateFormatter object.Syntax: Object oriented style: int IntlDateFormatter::getCalendar( void )Procedural style: int datefmt_get_calendar( IntlDateFormatter $fmt ) Parameters: This function accepts single parameter $fmt which holds the resource of formatter.Return Value: This function returns the calendar type which is used by the formatter. The formatter object are either IntlDateFormatter::TRADITIONAL or IntlDateFormatter::GREGORIAN.Below programs illustrate the IntlDateFormatter::getCalendar() function in PHP:Program 1: php <?php // Create a date formatter $formatter = datefmt_create( 'en_US', IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'Asia/Kolkata', IntlDateFormatter::TRADITIONAL, "MM/dd/yyyy" ); // Get the calendar type echo 'Calendar of formatter: ' . datefmt_get_calendar($formatter) . "\n"; // Get the format of date/time value as a string echo "Formatted calendar output: " . datefmt_format( $formatter , 0) . "\n\n"; // Set the calendar type used by the formatter datefmt_set_calendar($formatter, IntlDateFormatter::GREGORIAN); // Get the calendar type echo 'Calendar of formatter: ' . datefmt_get_calendar($formatter) . "\n"; // Get the format of date/time value as a string echo "First Formatted output is " . datefmt_format( $formatter , 0); ?> Output: Calendar of formatter: 0 Formatted calendar output: 01/01/1970 Calendar of formatter: 1 First Formatted output is 01/01/1970 Program 2: php <?php // Create a date formatter $formatter = datefmt_create( 'en_US', IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'Asia/Kolkata', IntlDateFormatter::TRADITIONAL, "MM/dd/yyyy" ); // Get the calendar type echo 'Calendar of formatter: ' . $formatter->getCalendar() . "\n"; // Get the format of date/time value as a string echo "Formatted calendar output: " . $formatter->format(0) . "\n\n"; // Set the calendar type used by the formatter $formatter->setCalendar(IntlDateFormatter::GREGORIAN); // Get the calendar type echo 'Calendar of formatter: ' . $formatter->getCalendar() . "\n"; // Get the format of date/time value as a string echo "First Formatted output is " . $formatter->format(0); ?> Output: Calendar of formatter: 0 Formatted calendar output: 01/01/1970 Calendar of formatter: 1 First Formatted output is 01/01/1970 Reference: https://www.php.net/manual/en/intldateformatter.getcalendar.php Comment More infoAdvertise with us Next Article PHP | IntlDateFormatter getCalendar() Function jit_t Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Intl Similar Reads PHP | IntlDateFormatter getDateType() Function The IntlDateFormatter::getDateType() function is an inbuilt function in PHP which is used to get the datetype used for the IntlDateFormatter object. Syntax: Object oriented style: int IntlDateFormatter::getDateType( void ) Procedural style: int datefmt_get_datetype( IntlDateFormatter $fmt ) Paramete 2 min read PHP | IntlDateFormatter getErrorCode() Function, The IntlDateFormatter::getErrorCode() function is an inbuilt function in PHP which is used to return the error code from last operation. Syntax: Object-oriented style: int IntlDateFormatter::getErrorCode( void ) Procedural style: int datefmt_get_error_code( IntlDateFormatter $fmt ) Parameters: This 1 min read PHP | IntlDateFormatter format() Function The IntlDateFormatter::format() function is an inbuilt function in PHP which is used to format the date/time value as a string. Syntax: Object oriented style: string IntlDateFormatter::format( mixed $value ) Procedural style: string datefmt_format( IntlDateFormatter $fmt, mixed $value ) Parameters: 2 min read PHP | IntlDateFormatter formatObject() Function The IntlDateFormatter::formatObject() function is an inbuilt function in PHP which is used to formats an IntlDateFormatter object. This function allows to format the IntlCalendar or DateTime object. Syntax: Object oriented style:string IntlDateFormatter::formatObject( object $object, mixed $format = 2 min read PHP | IntlCalendar isSet() Function The IntlCalendar::isSet() function is an inbuilt function in PHP which is used to check whether a given field is set or not. This function is opposite to IntlCalendar::clear() function. Syntax: Object oriented style bool IntlCalendar::isSet( int $field ) Procedural style bool intlcal_is_set( IntlCal 1 min read PHP | IntlCalendar get() Function 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 men 2 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 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 getActualMaximum() Function The IntlCalendar::getActualMaximum() function is an inbuilt function in PHP which is used to return the field relative maximum value around the current time. Syntax: Object oriented style int IntlCalendar::getActualMaximum( int $field ) Procedural style int intlcal_get_actual_maximum( IntlCalendar $ 1 min read PHP IntlCalendar getActualMinimum() Function The IntlCalendar::getActualMinimum() function is an inbuilt function in PHP which is used to return the field relative minimum value around the current time. Syntax: Object oriented styleint IntlCalendar::getActualMinimum( int $field )Procedural styleint intlcal_get_actual_minimum( IntlCalendar $cal 1 min read Like