
エントリーの編集

エントリーの編集は全ユーザーに共通の機能です。
必ずガイドラインを一読の上ご利用ください。
記事へのコメント0件
- 注目コメント
- 新着コメント
このエントリーにコメントしてみましょう。
注目コメント算出アルゴリズムの一部にLINEヤフー株式会社の「建設的コメント順位付けモデルAPI」を使用しています

- バナー広告なし
- ミュート機能あり
- ダークモード搭載
関連記事
【JavaScript】日時の表示 - Qiita
//データオブジェクトの初期化 const now = new Date(); //現在の年を取得 const year = now.getFullYea... //データオブジェクトの初期化 const now = new Date(); //現在の年を取得 const year = now.getFullYear(); //現在の月を取得(月は0-11で表す) const month = now.getMonth(); //現在の日付を取得 const date = now.getDate(); //現在の時間を取得 const hour = now.getHours(); //現在の分を取得 const min = now.getMinutes(); //『年/月/日 時間:分』の形で文字列を定数outputに代入 const output = `${year + 1900}/${month + 1 }/${date} ${hour}:${min}`; //id属性がtimeのコンテンツをoutputに書き換える document.getEl