How to get the day from a particular date using JavaScript

前端 未结 3 652
情歌与酒
情歌与酒 2020-12-07 01:29

I am new to JavaScript. My requirement is that T want to pop up a message on particular days (like Sunday, Monday...) all through when a date is selected.

I tried

3条回答
  •  孤城傲影
    2020-12-07 02:27

    var days= ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
    var today = new Date();
    document.write(days[today.getDay()]);
    

提交回复
热议问题