How to get the previous date in angular?

后端 未结 3 1952
广开言路
广开言路 2021-01-12 05:49

Please help me getting the previous dates in angular 4.

currentdate: Date;
this.currentdate = new Date();
console.log(this.datePipe.transform(this.currentdat         


        
3条回答
  •  悲哀的现实
    2021-01-12 06:26

    Try this

    let dte = new Date();
    dte.setDate(dte.getDate() - 2);
    console.log(dte.toString());

提交回复
热议问题