LoginSignup
1
0

More than 3 years have passed since last update.

ISO8601 形式を日本表記に変換して表示 JavaScript

Last updated at Posted at 2020-11-17

前提・やりたいこと

Amazon DynamoDB に日付がISO-8601 形式の文字列として格納されていて、さらにUTCでした。
日本時間かつ、日付だけ表示したい。

これ

const dateFormatter = (dateIso8601: string) =>
  new Date(Date.parse(dateIso8601))
    .toLocaleDateString('ja-JP')
    .replace(/\//g, '.');
// 結果
2020.11.17

参考

追記

↑認識間違っていました。コメントいただきありがとうございます。

1
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0