export function getDateTime(value) {
var b = new Date(value);
var year = b.getFullYear()+'-';
var month = (b.getMonth()+1);
var date = b.getDate();
if(month<10){
month = '0'+ (b.getMonth()+1)+'-';
}else {
month = (b.getMonth()+1)+'-';
}
if(date<10){
date = '0'+ (b.getDate());
}
var str = String(year)+String(month)+String(date)+ ' ';
return str;
}
// 使用
import {getDateTime} from "@/utils/utils.js"
getDateTime(date); // 2022-07-20
标签:戳格,mm,dd,month,dddd,var
From: https://www.cnblogs.com/rzl795/p/16586141.html