js 获取昨天,今天和明天的年月日格式

 1 //昨天:
 2 const yestoday =  new Date().getTime() - 24*60*60*1000;
 3 
 4 //今天:
 5 const today = new Date();
 6 
 7 //明天:
 8 const tomorrow = new Date().getTime() + 24*60*60*1000;
 9 
10 //最终的格式 如:2017-09-21

 

posted @ 2017-09-21 18:55  Anetye  阅读(1943)  评论(0编辑  收藏  举报