
IntlGregorianCalendar::createFromDateTime 메서드는 DateTime 객체를 생성할 때 Locale 객체를 사용하여 지역 정보를 고려합니다.
Locale 객체가 null 인 경우, 메서드는 NullPointerException을 발생시킵니다.
Locale 객체가 유효하지 않은 경우, 메서드는 IllegalArgumentException을 발생시킵니다.
예를 들어, Locale 객체가 null 인 경우 다음과 같이 동작합니다.
#hostingforum.kr
php
$locale = null;
$dateTime = IntlGregorianCalendar::createFromDateTime($locale);
// NullPointerException이 발생합니다.
Locale 객체가 유효하지 않은 경우 다음과 같이 동작합니다.
#hostingforum.kr
php
$locale = new Locale("Invalid", "Locale");
$dateTime = IntlGregorianCalendar::createFromDateTime($locale);
// IllegalArgumentException이 발생합니다.
IntlGregorianCalendar::createFromDateTime 메서드는 DateTime 객체를 생성할 때 Locale 객체를 사용하여 지역 정보를 고려합니다. Locale 객체가 유효하지 않은 경우 메서드는 IllegalArgumentException을 발생시킵니다.
2025-05-15 04:09