インタラクティブリファレンス:フォーマット文字列のテスト、パラメータの参照、strtotime() 式の試用ができます。
{{ dateResult }}
<?php echo date("{{ dateFormat }}"); ?>
| {{ __t('th_character') }} | {{ __t('th_description') }} | {{ __t('th_example') }} | |
|---|---|---|---|
| {{ group.title }} | |||
{{ p.char }} |
{{ p.desc }} | {{ getParamExample(p.char) }} | |
{{ strtotimeResult.timestamp }}
{{ strtotimeResult.formatted }}
{{ strtotimeResult.relative }}
{{ strtotimePhpCode }}
| {{ __t('th_expression') }} | {{ __t('th_description') }} | {{ __t('label_result') }} |
|---|---|---|
{{ ref.expr }} |
{{ ref.desc }} | {{ getStrtotimeExample(ref.expr) }} |
関数 date(string $format, ?int $timestamp = null) は、Unix タイムスタンプまたは現在時刻を読みやすい文字列にフォーマットします。フォーマット文字列は Y(4桁の年)、m(先頭ゼロ付きの月)、d(日)、H:i:s(24時間形式の時:分:秒)などのプレースホルダーで構成されます。
strtotime(string $datetime, ?int $baseTimestamp = null) は英語のテキスト記述を Unix タイムスタンプに変換します。典型的な入力: "now"、"+1 day"、"next monday"、"first day of next month"、"last day of december 2025"。この関数は非常に柔軟で、"+2 weeks 3 days" のような組み合わせ式も理解します。
date("Y-m-d") — ISO日付: 2025-03-15date("d.m.Y") — ドイツ語形式: 15.03.2025date("Y-m-d H:i:s") — MySQL Datetimedate("c") — ISO 8601: 2025-03-15T14:30:00+01:00date("r") — RFC 2822: Sat, 15 Mar 2025 14:30:00 +0100date("U") — Unix タイムスタンプ