1.0.1 • Published 3 years ago
dsl_lianxi_node5 v1.0.1
class Moment {
constructor(time) {
this.time = time;
}
change() {
const oldtime = new Date(this.time);
const newtime = new Date();
const times = newtime - oldtime;
let yaer = Math.floor(times / 1000 / 60 / 60 / 24 / 365),
month = Math.floor(times / 1000 / 60 / 60 / 24 / 30 % 12),
day=Math.floor(times/1000/60/60/24%30),
hour=Math.floor(times/1000/60/60%24),
minute=Math.floor(times/1000/60%60);
return yaer+"年"+month+"月"+day+"日"+hour+"小时"+minute+"分钟"
}
}
module.exports=Moment