1
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?

More than 5 years have passed since last update.

日付と時刻 [サイ本p37]

Posted at

Date()コンストラクタ

var later = new Date(2018,0,1,17,10,30);//2018年1月1日現地時間午後5:10:30。
later.getMonth()
=>0 //1月を0とする月番号。
later.getDay()
=>5 //曜日。0が日曜日、5が金曜日。
later.toString()
=>"Fri Jan 01 2010 17:10:30 GMT-0800(PST)"

月と曜日は0から始まる。日は普通に1から始まる。

<感想>
日付を設定しておけば曜日を簡単に調べることができるのがすごいと思った。

1
0
1

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?