Javascript code for showing yesterday's date and todays date

前端 未结 5 1922
面向向阳花
面向向阳花 2020-12-02 18:29

How to show yesterday\'s date in my textbox the yesterday\'s date and at the same time, the today\'s date in ?

I have this home.php where I show the date yesterday(

5条回答
  •  日久生厌
    2020-12-02 18:45

    One liner:

    var yesterday = new Date(Date.now() - 864e5); // 864e5 == 86400000 == 24*60*60*1000
    

提交回复
热议问题