Newer
Older
gdtMimiProgram / common / formatTime.js
MrTan on 22 Nov 2022 400 bytes 列表页面按条件查询

export function js_date_time(unixtime){
  var timestr = new Date(parseInt(unixtime) * 1000);
  var datetime = timestr.toLocaleString().replace(/年|月/g,"-").replace(/日/g," ");
  return datetime;
}

/* 
  获取前几个月,默认前一个月的今天
*/
export function getLastMonth(monthNum = 1){
  let today = new Date() //当天
  today.setMonth(today.getMonth()-monthNum)
  return today;
}