Internationalization IntlDateFormatter::getDateType
IntlDateFormatter::getDateType
datefmt_get_datetype
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)
IntlDateFormatter::getDateType -- datefmt_get_datetype — IntlDateFormatter에 사용된 날짜 유형을 가져옵니다.
설명
객체 지향 스타일
public IntlDateFormatter::getDateType(): int|false
절차 스타일:
datefmt_get_datetype(IntlDateFormatter $formatter
): int|false
포맷터에서 사용하는 날짜 유형을 반환합니다.
매개변수
formatter
- 포맷터 리소스.
반환 값
포맷터의 현재 날짜 유형 값 또는 실패 시 false
입니다.
Examples
예제 #1 datefmt_get_datetype() 예제
<?php
$fmt = datefmt_create(
'en_US',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'America/Los_Angeles',
IntlDateFormatter::GREGORIAN
);
echo 'datetype of the formatter is : ' . datefmt_get_datetype($fmt);
echo 'First Formatted output with datetype is ' . datefmt_format($fmt, 0);
$fmt = datefmt_create(
'en_US',
IntlDateFormatter::SHORT,
IntlDateFormatter::FULL,
'America/Los_Angeles',
IntlDateFormatter::GREGORIAN
);
echo 'Now datetype of the formatter is : ' . datefmt_get_datetype($fmt);
echo 'Second Formatted output with datetype is ' . datefmt_format($fmt, 0);
?>
예제 #2 OO 예제
<?php
$fmt = new IntlDateFormatter(
'en_US',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'America/Los_Angeles',
IntlDateFormatter::GREGORIAN
);
echo 'datetype of the formatter is : ' . $fmt->getDateType();
echo 'First Formatted output is ' . $fmt->format(0);
$fmt = new IntlDateFormatter(
'en_US',
IntlDateFormatter::SHORT,
IntlDateFormatter::FULL,
'America/Los_Angeles',
IntlDateFormatter::GREGORIAN
);
echo 'Now datetype of the formatter is : ' . $fmt->getDateType();
echo 'Second Formatted output is ' . $fmt->format(0);
?>
위의 예는 다음을 출력합니다.
datetype of the formatter is : 0 First Formatted output is Wednesday, December 31, 1969 4:00:00 PM PT Now datetype of the formatter is : 2 Second Formatted output is 12/31/69 4:00:00 PM PT
기타
- datefmt_get_timetype() - IntlDateFormatter에 사용된 시간 유형을 가져옵니다.
- datefmt_create() - 날짜 포맷터 만들기