const dt = new Date();
const date = this.getTime(dt)
log.info(dt,'dt')
log.info(date,'date')
getTime (originVal,day) {
const dt = new Date(originVal);
const y = dt.getFullYear();
const m = (dt.getMonth() + 1 + "").padStart(2, "0");
const d = (dt.getDate() +"").padStart(2, "0");
// const hh = (dt.getHours() + "").padStart(2, "0");
// const mm = (dt.getMinutes() + "").padStart(2, "0");
// const ss = (dt.getSeconds() + "").padStart(2, "0");
// return `${y}-${m}-${d} ${hh}:${mm}:${ss}`;
return `${y}-${m}-${d} `;
},
程序员必须会的js_时间格式化函数
最新推荐文章于 2022-11-16 01:00:00 发布