◀︎  A  ▶︎

toLocale⭐︎String() と関連メソッドの比較

メソッド名

toLocaleString()

出力例:

年月日+時間(例:2026/01/01 11:22:33

メソッド名

toLocaleTimeString()

出力例:

時間のみ(例:12:34:56

メソッド名

toLocaleDateString()

出力例:

日付のみ(例:2026/01/01

toLocale⭐︎String() のよく使うオプション

プロパティ名 指定できる値の例 説明
year "numeric" (ニューメリック), "2-digit" 年(例:2025, 25)
month "numeric", "2-digit", "long", "short", "narrow" 月(例:6, 06, 6月)
day "numeric", "2-digit" 日(例:8, 08)
weekday "long", "short", "narrow" 曜日(例:日曜日, 日)
hour, minute, second "numeric", "2-digit" 時・分・秒(例:9, 09)
hour12 true, false 12時間制(AM/PM)かどうか
timeZone "Asia/Tokyo", "UTC" タイムゾーンの指定(任意)

◀︎  A  ▶︎
▼ Sample_Coding_144 ▼