php8.5
Home/ Manual/ intl / intlcalendar/ IntlCalendar::getType

IntlCalendar::getType

PHP function Edit on GitHub ✎

(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)

Get the calendar type

Description

Oop

IntlCalendar::getType(): string

Procedural

intlcal_get_type(IntlCalendar $calendar): string

A string describing the type of this calendar. This is one of the valid values for the calendar keyword value 'calendar'.

Parameters

calendar

Intl-calendar

Return Values

A string representing the calendar type, such as 'gregorian', 'islamic', etc.

Examples

IntlCalendar::getType()

php
<?php
ini_set('date.timezone', 'Europe/Lisbon');
ini_set('intl.default_locale', 'en_US');

$cal = IntlCalendar::createInstance(NULL, '@calendar=ethiopic-amete-alem');
var_dump($cal->getType());

$cal = new IntlGregorianCalendar();
var_dump($cal->getType());

The above example will output:

output
string(19) "ethiopic-amete-alem"
string(9) "gregorian"

Source: reference/intl/intlcalendar/gettype.xml · from the official PHP manual (php/doc-en)