豚吐露@wiki
日付の文字列の作り方
最終更新:
ohden
-
view
日付の文字列の作り方
iso
ISO準拠。
new Date().toISOString()
2020-01-01T01:23:45.678Z
yyyy/m/d HH:MM:ss
日本っぽいヤツ。
new Date().toLocaleString('ja-JP')
new Date().toLocaleString('ja')
new Date().toLocaleString()
2020/1/1 1:23:45
yyyy-mm-dd HH:MM:ss
スウェーデンのlocale stringが使いやすい。
new Date().toLocaleString('sv-SE')
new Date().toLocaleString('sv')
2020-01-01 01:23:45
yyyy/mm/dd HH:MM:ss
スウェーデンのbaseに'-'を'/'に置換するのが良い。
new Date().toLocaleString('sv-SE').replace(/-/g, '/')
new Date().toLocaleString('sv').replace(/-/g, '/')
2025-01-01 01:23:45
更新日: 2025年10月01日 (水) 11時44分43秒