IntlDateFormatter クラス
(PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
導入
Date Formatter は、パターン文字列や出来合いのパターンを使用して ロケールに依存する日付のフォーマット/パースを行う具象クラスです。
このクラスは ICU の日付フォーマット機能を表します。 これを使用すると、パターン文字列や出来合いのパターンを使用して 日付を各地域のフォーマットで表示したり、 文字列をパースして PHP の日付として扱ったりすることができます。
クラス概要
IntlDateFormatter
{
/* メソッド */
__construct
( string
$locale
, int $datetype
, int $timetype
[, string $timezone
[, int $calendar
[, string $pattern
]]] )
static
IntlDateFormatter create
( string
}$locale
, int $datetype
, int $timetype
[, string $timezone
[, int $calendar
[, string $pattern
]]] )定義済み定数
これらの定数は、DateType や TimeType のコンストラクタでさまざまなフォーマットを指定するために使用します。
-
IntlDateFormatter::NONE(integer) - この要素を含まない
-
IntlDateFormatter::FULL(integer) - 完全に指定した形式 (Tuesday, April 12, 1952 AD あるいは 3:30:42pm PST)
-
IntlDateFormatter::LONG(integer) - 長い形式 (January 12, 1952 あるいは 3:30:32pm)
-
IntlDateFormatter::MEDIUM(integer) - 中間の形式 (Jan 12, 1952)
-
IntlDateFormatter::SHORT(integer) - 不可欠なデータのみを扱う最も省略した形式 (12/13/52 あるいは 3:30pm)
次の整数定数は、暦の種類を指定するものです。 これらの暦は、すべてグレゴリオ暦にもとづくものです。 グレゴリオ暦以外の暦はロケールで指定しなければなりません。 たとえば、 locale="hi@calendar=BUDDHIST" のようになります。
目次
- IntlDateFormatter::create — Date Formatter を作成する
- IntlDateFormatter::format — 日付/時刻 の値を文字列としてフォーマットする
- IntlDateFormatter::formatObject — オブジェクトの書式を設定する
- IntlDateFormatter::getCalendar — IntlDateFormatter が使用するカレンダーを取得する
- IntlDateFormatter::getDateType — IntlDateFormatter が使用する日付形式を取得する
- IntlDateFormatter::getErrorCode — 直近の操作のエラーコードを取得する
- IntlDateFormatter::getErrorMessage — 直近の操作のエラーテキストを取得する
- IntlDateFormatter::getLocale — Formatter が使用するロケールを取得する
- IntlDateFormatter::getPattern — IntlDateFormatter が使用するパターンを取得する
- IntlDateFormatter::getTimeType — IntlDateFormatter が使用する時刻形式を取得する
- IntlDateFormatter::getTimeZoneId — IntlDateFormatter が使用するタイムゾーン ID を取得する
- IntlDateFormatter::getCalendarObject — カレンダーを取得する
- IntlDateFormatter::getTimeZone — タイムゾーンを取得する
- IntlDateFormatter::isLenient — IntlDateFormatter で使用する寛大さを取得する
- IntlDateFormatter::localtime — 文字列をパースして、フィールドベースの時刻値にする
- IntlDateFormatter::parse — 文字列をパースしてタイムスタンプにする
- IntlDateFormatter::setCalendar — 使用するカレンダーを設定する
- IntlDateFormatter::setLenient — パーサの寛大さを設定する
- IntlDateFormatter::setPattern — IntlDateFormatter が使用するパターンを設定する
- IntlDateFormatter::setTimeZoneId — 使用するタイムゾーンを設定する
- IntlDateFormatter::setTimeZone — タイムゾーンを設定する