Javascript code for showing yesterday's date and todays date

前端 未结 5 1924
面向向阳花
面向向阳花 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 19:02

    Yesterday Date can be calculated as:-

    let now = new Date();
        var defaultDate = now - 1000 * 60 * 60 * 24 * 1;
        defaultDate = new Date(defaultDate);
    

提交回复
热议问题