PHP | IntlCalendar getType() Function
Last Updated :
03 Apr, 2023
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:
string IntlCalendar::getType( void )
string intlcal_get_type( IntlCalendar $cal )
Parameters: This function accepts single parameter $cal which holds the resource of IntlCalendar.
Return Value: This function returns a string value which represents the calendar type.
Below program illustrates the IntlCalendar::getType() function in PHP:
Program:
php
<?php
ini_set ( 'date.timezone' , 'Asia/Calcutta' );
ini_set ( 'intl.default_locale' , 'en_US' );
$calendar = IntlCalendar::createInstance(NULL, 'en_US' );
var_dump( $calendar -> getType ());
$calendar = IntlCalendar::createInstance(NULL, '@calendar=islamic' );
var_dump( $calendar -> getType ());
$calendar = IntlCalendar::fromDateTime( '2019-03-21 09:19:29' );
var_dump( $calendar -> getType ());
?>
|
Output:
string(9) "gregorian"
string(7) "islamic"
string(9) "gregorian"
Reference: https://www.php.net/manual/en/intlcalendar.gettype.php
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...