获取当前时间this.endDateValue:
this.endDateValue =new Date();
然后通过getTime()方法 获取距 1970 年 1 月 1 日之间的毫秒数,减去往前推n天的毫秒数;再通过newDate()转换一下即可;
this.startDateValue =new Date(this.endDateValue.getTime() - n *24 *60 *60 *1000);
获取当前时间this.endDateValue:
this.endDateValue =new Date();
然后通过getTime()方法 获取距 1970 年 1 月 1 日之间的毫秒数,减去往前推n天的毫秒数;再通过newDate()转换一下即可;
this.startDateValue =new Date(this.endDateValue.getTime() - n *24 *60 *60 *1000);
本文标题:获取当前日期往前推n天的日期
本文链接:https://www.haomeiwen.com/subject/puhwiqtx.html
网友评论