書式
Unicode CLDR をもとに Go がレンダリングするロケール対応の書式設定です。オプションと出力は JavaScript の Intl と同じです。言語はページ下部で切り替えられます。
日本語
CLDR 48 (cldr-json 48.2.1)
jaja-Jpan-JP書字方向 ltr数字 latnJPYタイムゾーン America/New_York
数値
Intl.NumberFormat のオプションを、CLDR データからサーバー側で書式化します。
| 入力 | オプション | 結果 |
|---|---|---|
1234567.891 | {} | 1,234,567.891 |
-0.256 | {style: "percent", maximumFractionDigits: 1} | -25.6% |
1234567 | {notation: "compact"} | 123万 |
1234567 | {notation: "compact", compactDisplay: "long"} | 123万 |
0.000123 | {notation: "scientific"} | 1.23E-4 |
1234567.891 | {notation: "engineering"} | 1.235E6 |
1234.5678 | {maximumSignificantDigits: 3} | 1,230 |
2.5 | {maximumFractionDigits: 0, roundingMode: "halfEven"} | 2 |
0 | {signDisplay: "exceptZero"} | 0 |
42 | {signDisplay: "always"} | +42 |
7 | {minimumIntegerDigits: 3} | 007 |
通貨
金額は正確に扱われ(整数の補助単位)、CLDR の通貨桁数を使用します。現地通貨:JPY。
| 入力 | オプション | 結果 |
|---|---|---|
1234.5 JPY | {style: "currency", currency: "JPY"} | ¥1,235 |
-1234.5 JPY | {…, currencySign: "accounting"} | (¥1,235) |
1 JPY | {…, currencyDisplay: "name"} | 1円 |
1234.5 JPY | {…, currencyDisplay: "name"} | 1,235円 |
1234.5 JPY | {…, currencyDisplay: "code"} | JPY 1,235 |
1234567 JPY | {…, notation: "compact"} | ¥123万 |
9.99 USD | {style: "currency", currency: "USD", currencyDisplay: "narrowSymbol"} | $9.99 |
1234.5 JPY | {style: "currency", currency: "JPY"} | ¥1,235 |
1234.5 BHD | {style: "currency", currency: "BHD"} | BHD 1,234.500 |
日付と時刻
Intl.DateTimeFormat:CLDR のスタイル、スケルトン、時間帯表現、紀元、時間周期(12/24 時間制)。いずれも最初の列の時点を、お使いのタイムゾーンで表示します。
| 入力 | オプション | 結果 |
|---|---|---|
2026-07-04T15:30:45.123Z | {dateStyle: "full", timeZone: "America/New_York"} | 2026年7月4日土曜日 |
2026-07-04T15:30:45.123Z | {dateStyle: "long", timeStyle: "short", timeZone: "America/New_York"} | 2026年7月4日 11:30 |
2026-07-04T15:30:45.123Z | {dateStyle: "medium", timeStyle: "medium", timeZone: "America/New_York"} | 2026/07/04 11:30:45 |
2026-07-04T15:30:45.123Z | {dateStyle: "short", timeStyle: "full", timeZone: "America/New_York"} | 2026/07/04 11時30分45秒 米国東部夏時間 |
2026-07-04T15:30:45.123Z | {weekday: "long", month: "long", day: "numeric", timeZone: "America/New_York"} | 7月4日土曜日 |
2026-07-04T15:30:45.123Z | {year: "numeric", month: "short", timeZone: "America/New_York"} | 2026年7月 |
2026-07-04T15:30:45.123Z | {hour: "numeric", minute: "2-digit", hour12: true, timeZone: "America/New_York"} | 午前11:30 |
2026-07-04T15:30:45.123Z | {hour: "numeric", minute: "2-digit", hourCycle: "h23", timeZone: "America/New_York"} | 11:30 |
2026-07-04T15:30:45.123Z | {dayPeriod: "long", hour: "numeric", timeZone: "America/New_York"} | 11時 |
2026-07-04T15:30:45.123Z | {era: "long", year: "numeric", timeZone: "America/New_York"} | 西暦2026年 |
2026-07-04T15:30:45.123Z | {minute: "2-digit", second: "2-digit", fractionalSecondDigits: 3, timeZone: "America/New_York"} | 30:45.123 |
タイムゾーン
同じ時点を他のタイムゾーンで、CLDR のタイムゾーン名(固有、一般、地域、オフセット)とともに表示します。
| 入力 | オプション | 結果 |
|---|---|---|
America/New_York | {hour: "numeric", minute: "2-digit", timeZoneName: "long"} | 11:30 米国東部夏時間 |
Asia/Tokyo | {hour: "numeric", minute: "2-digit", timeZoneName: "short"} | 0:30 JST |
America/New_York | {hour: "numeric", minute: "2-digit", timeZoneName: "longGeneric"} | 11:30 米国東部時間 |
America/Los_Angeles | {hour: "numeric", minute: "2-digit", timeZoneName: "shortGeneric"} | 8:30 Los Angeles時間 |
Asia/Kolkata | {hour: "numeric", minute: "2-digit", timeZoneName: "shortOffset"} | 21:00 GMT+5:30 |
Australia/Lord_Howe | {hour: "numeric", minute: "2-digit", timeZoneName: "longOffset"} | 2:00 GMT+10:30 |
Europe/London | {hour: "numeric", minute: "2-digit", timeZoneName: "long"} | 16:30 英国夏時間 |
Pacific/Chatham | {hour: "numeric", minute: "2-digit", timeZoneName: "long"} | 4:15 チャタム標準時 |
日付範囲
Intl.DateTimeFormat の formatRange:CLDR の範囲書式では、共通のフィールドは一度だけ表示され、異なるフィールドだけが繰り返されます。
| 入力 | オプション | 結果 |
|---|---|---|
2026-07-04T15:30:45.123Z – 2026-07-04T17:00:45.123Z | {hour: "numeric", minute: "2-digit", timeZone: "America/New_York"} | 11時30分~13時00分 |
2026-07-04T15:30:45.123Z – 2026-07-04T17:00:45.123Z | {dateStyle: "long", timeStyle: "short", timeZone: "America/New_York"} | 2026/7/4 11時30分~13時00分 |
2026-07-04T15:30:45.123Z – 2026-07-09T15:30:45.123Z | {dateStyle: "medium", timeZone: "America/New_York"} | 2026/07/04~2026/07/09 |
2026-07-04T15:30:45.123Z – 2026-08-20T15:30:45.123Z | {month: "long", day: "numeric", timeZone: "America/New_York"} | 07/04~08/20 |
2026-07-04T15:30:45.123Z – 2027-01-15T15:30:45.123Z | {year: "numeric", month: "short", day: "numeric", timeZone: "America/New_York"} | 2026/07/04~2027/01/15 |
単位
Intl.NumberFormat の style "unit":複数形に対応した CLDR の単位パターン、複合単位(毎時など)、コンパクト表記。
| 入力 | オプション | 結果 |
|---|---|---|
1 kilometer | {style: "unit", unit: "kilometer", unitDisplay: "long"} | 1 キロメートル |
2.5 kilometer | {…, unitDisplay: "long"} | 2.5 キロメートル |
88 kilometer-per-hour | {unit: "kilometer-per-hour"} | 88 km/h |
21.5 celsius | {unit: "celsius"} | 21.5°C |
512 megabyte | {unit: "megabyte", unitDisplay: "narrow"} | 512MB |
3 liter-per-kilometer | {unit: "liter-per-kilometer", unitDisplay: "long"} | 3 リットル毎キロメートル |
1234567 meter | {unit: "meter", notation: "compact", unitDisplay: "long"} | 123万 メートル |
相対時間
Intl.RelativeTimeFormat:複数形ルールを含む CLDR の dateFields。numeric "auto" では「昨日」のような語を使います。
| 入力 | オプション | 結果 |
|---|---|---|
-1 day | {numeric: "auto"} | 昨日 |
2 day | {numeric: "auto"} | 明後日 |
-3 hour | {} | 3 時間前 |
5 minute | {style: "short"} | 5 分後 |
-1.5 week | {style: "narrow"} | 1.5週間前 |
1 quarter | {numeric: "auto"} | 翌四半期 |
-10 year | {} | 10 年前 |
リスト
Intl.ListFormat:CLDR のリストパターンに加え、ICU がコード内で適用するスペイン語とヘブライ語のルール。
| 入力 | オプション | 結果 |
|---|---|---|
日本語 · Go · htmx | {type: "conjunction"} | 日本語、Go、htmx |
日本語 · Go · htmx | {type: "disjunction"} | 日本語、Go、またはhtmx |
日本語 · Go · htmx · Cloudflare | {type: "unit", style: "narrow"} | 日本語GohtmxCloudflare |
日本語 · Go | {style: "short"} | 日本語、Go |
期間
Intl.DurationFormat。数値単位は Chrome の出力に合わせています。
| 入力 | オプション | 結果 |
|---|---|---|
1d 2h 5m 30.25s | {} | 1 日 2 時間 5 分 30 秒 250 ms |
1d 2h 5m 30.25s | {style: "long"} | 1 日 2 時間 5 分 30 秒 250 ミリ秒 |
1d 2h 5m 30.25s | {style: "narrow"} | 1d2h5m30s250ms |
1d 2h 5m 30.25s | {style: "digital", fractionalDigits: 2} | 1 日 2:05:30.25 |
複数形ルール
CLDR の複数形カテゴリと、それぞれが選ばれる最初の数値。
| 入力 | オプション | 結果 |
|---|---|---|
cardinal · other | {type: "cardinal"} | 0, 1, 2, 3, 4, 0.0 |
ordinal · other | {type: "ordinal"} | 0, 1, 2, 3, 4 |
週
Intl.Locale の getWeekInfo:ロケールの地域に対応する CLDR の weekData(1 = 月曜日 … 7 = 日曜日)。
| 入力 | オプション | 結果 |
|---|---|---|
firstDay | getWeekInfo() | 7 |
weekend | getWeekInfo() | 6, 7 |
minimalDays | CLDR weekData | 1 |