const addZero = (num) => {
return num < 10 ? "0" + num : num;
};
const millisecondsAddZero = (num) => {
if(num <10){
return "00" + num
}else if(num<100&&num>=10){
return "0" + num
}else{
return num
}
};
const formatDateTime = (date) => {
const time = new Date(date);
time.setTime(time.setHours(time.getHours() + 8));
const Y = time.getFullYear() + ".";
const M = addZero(time.getMonth() + 1) + ".";
const D = addZero(time.getDate()) + " ";
const h = addZero(time.getHours()) + ":";
const m = addZero(time.getMinutes()) + ":";
const s = addZero(time.getSeconds()) + ".";
const ss = millisecondsAddZero(time.getMilliseconds());
return Y + M + D + h + m + s + ss;
};
08-03
3047