0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

toLocaleDateStringで日付けフォーマット

Last updated at Posted at 2024-08-09

toLocaleDateStringいつも忘れるのでメモ。

const date = Date.now();
// 1723185748505

const formatDate = new Date(date).toLocaleDateString("ja-JP");
// 2024/8/9

オプションも設定できるらしい。

toLocaleDateString(locales, options)

時間の表示

const formatDate = new Date(date).toLocaleDateString("ja-JP", {
  hour: "2-digit",
  minute: "2-digit"
});
// 2024/8/9 15:53

0
0
0

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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?