Add 6 hours to current time and display to page

后端 未结 5 1221
执笔经年
执笔经年 2020-12-10 01:40

So, I\'m trying to add some labels to a graph, and I want to add them to 6, 12, 18, and 24 hours on the horizontal axis.

I want to write these times in a \"hh:mm\"

5条回答
  •  Happy的楠姐
    2020-12-10 02:15

    I like to do this like that

    new Date(new Date().setHours(new Date().getHours() + 6))
    

    or

    new Date(new Date().setHours(new Date().getHours() + 6)).toString()
    

提交回复
热议问题