格式

由 Go 依據 Unicode CLDR 渲染的地區格式,選項與輸出和 JavaScript 的 Intl 一致。可在頁面底部切換語言。

繁體中文
CLDR 48 (cldr-json 48.2.1)
zh-Hantzh-Hant-TW方向 ltr數字 latn原生 hanidecTWD時區 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
1234567.891{numberingSystem: "hanidec"}一,二三四,五六七.八九一
貨幣
金額精確無誤(以整數最小單位表示),並採用 CLDR 的貨幣小數位數。當地貨幣:TWD。
輸入選項結果
1234.5 TWD{style: "currency", currency: "TWD"}$1,234.50
-1234.5 TWD{…, currencySign: "accounting"}($1,234.50)
1 TWD{…, currencyDisplay: "name"}1.00 新台幣
1234.5 TWD{…, currencyDisplay: "name"}1,234.50 新台幣
1234.5 TWD{…, currencyDisplay: "code"}TWD 1,234.50
1234567 TWD{…, 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 樣式、骨架、時段、紀元與小時制,全部針對第一欄中的時間點,並依你的時區顯示。
輸入選項結果
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年7月4日 上午11:30:45
2026-07-04T15:30:45.123Z{dateStyle: "short", timeStyle: "full", timeZone: "America/New_York"}2026/7/4 上午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
2026-07-04T15:30:45.123Z{dateStyle: "medium", timeZone: "America/New_York", numberingSystem: "hanidec"}二〇二六年七月四日
時區
同一時間點在其他時區中的顯示,附帶 CLDR 時區名稱:特定、通用、地點與時差。
輸入選項結果
America/New_York{hour: "numeric", minute: "2-digit", timeZoneName: "long"}上午11:30 [東部夏令時間]
Asia/Tokyo{hour: "numeric", minute: "2-digit", timeZoneName: "short"}上午12:30 [GMT+9]
America/New_York{hour: "numeric", minute: "2-digit", timeZoneName: "longGeneric"}上午11:30 [東部時間]
America/Los_Angeles{hour: "numeric", minute: "2-digit", timeZoneName: "shortGeneric"}上午8:30 [PT]
Asia/Kolkata{hour: "numeric", minute: "2-digit", timeZoneName: "shortOffset"}下午9: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"}下午4: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至下午1: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 – 下午1:00
2026-07-04T15:30:45.123Z – 2026-07-09T15:30:45.123Z{dateStyle: "medium", timeZone: "America/New_York"}2026/7/4至2026/7/9
2026-07-04T15:30:45.123Z – 2026-08-20T15:30:45.123Z{month: "long", day: "numeric", timeZone: "America/New_York"}7/4至8/20
2026-07-04T15:30:45.123Z – 2027-01-15T15:30:45.123Z{year: "numeric", month: "short", day: "numeric", timeZone: "America/New_York"}2026/7/4至2027/1/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 公里/小時
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 毫秒
1d 2h 5m 30.25s{style: "long"}1 天 2 小時 5 分鐘 30 秒 250 毫秒
1d 2h 5m 30.25s{style: "narrow"}1 天2 小時5 分鐘30 秒250 毫秒
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 = 星期日)。
輸入選項結果
firstDaygetWeekInfo()7
weekendgetWeekInfo()6, 7
minimalDaysCLDR weekData1