JavaScript how to get tomorrows date in format dd-mm-yy

后端 未结 15 1544
情歌与酒
情歌与酒 2020-11-29 02:31

I am trying to get JavaScript to display tomorrows date in format (dd-mm-yyyy)

I have got this script which displays todays date in format (dd-mm-yyyy)



        
15条回答
  •  时光取名叫无心
    2020-11-29 02:46

    Its really simple:

    1: Create date object with today' date and time. 2: Use date object methods to retrieve day, month and full year and concatenate them using the + operator.

    Visit http://www.thesstech.com/javascript/date-time JavaScript for detailed tutorial on date and time.

    Sample Code:

      var my_date = new Date();  
      var tomorrow_date =       (my_date .getDate()+1)  + "-" + (my_date .getMonth()+1) + "-" + my_date .getFullYear();
      document.write(tomorrow_date);
    

提交回复
热议问题