IntlDateFormatter::getCalendar

datefmt_get_calendar

(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)

IntlDateFormatter::getCalendar -- datefmt_get_calendarIntlDateFormatter tarafından kullanılan takvim türünü döndürür

Açıklama

Nesne yönelimli kullanım

public function IntlDateFormatter::getCalendar(): int|false

Yordamsal kullanım

function datefmt_get_calendar(IntlDateFormatter $biçemleyici): int|false

Biçemleyici tarafından kullanılan takvimin türünü döndürür.

Bağımsız Değişkenler

biçemleyici

Biçemleyici nesne.

Dönen Değerler

Biçemleyici tarafından kullanılan takvim türü. IntlDateFormatter::TRADITIONAL veya IntlDateFormatter::GREGORIAN olabilir. Başarısızlık durumunda false döner.

Örnekler

Örnek 1 - datefmt_get_calendar() örneği

<?php
$fmt = datefmt_create(
    "en_US",
    IntlDateFormatter::FULL,
    IntlDateFormatter::FULL,
    'America/Los_Angeles',
    IntlDateFormatter::GREGORIAN
);
echo "Biçemleyicinin takvimi: " . datefmt_get_calendar($fmt);
datefmt_set_calendar($fmt, IntlDateFormatter::TRADITIONAL);
echo "\nBiçemleyicinin yeni takvimi: " . datefmt_get_calendar($fmt);
?>

Örnek 2 - Nesne yönelimli kullanım örneği

<?php
$fmt = new IntlDateFormatter(
    "en_US",
    IntlDateFormatter::FULL,
    IntlDateFormatter::FULL,
    'America/Los_Angeles',
    IntlDateFormatter::GREGORIAN
);
echo "Biçemleyicinin takvimi: ".$fmt->getCalendar();
$fmt->setCalendar(IntlDateFormatter::TRADITIONAL);
echo "\nBiçemleyicinin yeni takvimi: ".$fmt->getCalendar();

?>

Yukarıdaki örneğin çıktısı:

Biçemleyicinin takvimi: 1
Biçemleyicinin yeni takvimi: 0

Örnek 3 - Geçersiz yerel örneği

<?php
try {
    $fmt = new IntlDateFormatter(
        'gecersiz_yerel',
        IntlDateFormatter::FULL,
        IntlDateFormatter::FULL,
        'bilmemneresi',
        IntlDateFormatter::GREGORIAN,
    );
} catch (\Error $e) {
    // ...
}
?>

Ayrıca Bakınız

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top