For example the previous day is:
let a = new Date();
a.setDate(a.getDate() - 1);
a.Format("yyyy-MM-dd hh:mm:ss.S");
is the previous day's date;
The previous month:
let a = new Date();
a.setMonth(a.getMonth() - 1);
a.Format("yyyy-MM-dd hh:mm:ss.S");
Other time methods and so on;
I don't know why this method has not been discovered before;
Format is a date formatting method written by a big guy, which is very easy to use;