Javascript code for showing yesterday's date and todays date

前端 未结 5 1923
面向向阳花
面向向阳花 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:41

    Yesterday's date can be calculated as,

    var prev_date = new Date();
    prev_date.setDate(prev_date.getDate() - 1);
    

提交回复
热议问题