라이브러리

[PHP] IntlDateFormatter::getCalendar - IntlDateFormatter에 사용된 달력 유형을 가져옵니다.




IntlDateFormatter::getCalendar

`IntlDateFormatter::getCalendar` 메소드는 국제 날짜 형식에 사용되는 달력을 반환합니다. 이 메소드는 `IntlDateFormatter` 객체의 속성을 사용하여 달력을 생성합니다.

사용법


`IntlDateFormatter::getCalendar` 메소드는 다음과 같은 형식으로 사용할 수 있습니다.

#hostingforum.kr
php

IntlDateFormatter::getCalendar($calendarType)



* `$calendarType`: 사용할 달력을 지정하는 문자열입니다. 가능한 값은 다음과 같습니다.
+ `gregorian`: Григор리안 달력 (기본값)
+ `japanese`: 일본 달력
+ `chinese`: 중국 달력
+ `persian`: 페르시아 달력
+ `islamic`: 이슬람 달력
+ `hebrew`: 히브리 달력
+ `buddhist`: 불교 달력
+ `coptic`: 콥트 달력
+ `ethiopic`: 에티오피아 달력
+ `mayan`: 마야 달력
+ `mongolian`: 몽골 달력

예제


다음 예제에서는 `IntlDateFormatter` 객체를 생성하고 `getCalendar` 메소드를 사용하여 달력을 반환합니다.

#hostingforum.kr
php

// Gregorian 달력을 사용하는 IntlDateFormatter 객체 생성

$dateFormatter = new IntlDateFormatter('en_US', IntlDateFormatter::FULL, IntlDateFormatter::FULL);



// Gregorian 달력을 반환

$calendar = $dateFormatter->getCalendar('gregorian');

echo "Gregorian 달력:
";

print_r($calendar);



// 일본 달력을 사용하는 IntlDateFormatter 객체 생성

$dateFormatter = new IntlDateFormatter('ja_JP', IntlDateFormatter::FULL, IntlDateFormatter::FULL);



// 일본 달력을 반환

$calendar = $dateFormatter->getCalendar('japanese');

echo "
일본 달력:
";

print_r($calendar);



이 예제에서는 `IntlDateFormatter` 객체를 생성하고 `getCalendar` 메소드를 사용하여 Gregorian 달력과 일본 달력을 반환합니다. 반환된 달력 객체는 `print_r` 함수를 사용하여 출력됩니다.

참고


* `IntlDateFormatter` 객체는 국제 날짜 형식에 사용되는 달력을 반환합니다.
* `getCalendar` 메소드는 달력을 반환하는 데 사용됩니다.
* 달력 타입은 문자열로 지정됩니다.
* 가능한 달력 타입은 `gregorian`, `japanese`, `chinese`, `persian`, `islamic`, `hebrew`, `buddhist`, `coptic`, `ethiopic`, `mayan`, `mongolian`입니다.
  • profile_image
    나우호스팅 @pcs8404 

    호스팅포럼 화이팅!

    댓글목록

    등록된 댓글이 없습니다.

  • 전체 10,077건 / 443 페이지

검색

게시물 검색