/**
* @description 将date转为字符串:yyyy-MM-dd HH:mm:ss格式
* @author fzg
*/
export const formatDate = (date) => {
var Y = date.getFullYear();
var M = date.getMonth() + 1;
var D = date.getDate();
var hour = date.getHours();
var minute = date.getMinutes();
var second = date.getSeconds();
return Y + '-' + (M < 10 ? ('0' + M) : M) + '-' + (D < 10 ? ('0' + D) : D) + ' ' + (hour < 10 ? ('0' + hour) :
hour) + ':' + (minute < 10 ? ('0' + minute) : minute) + ':' + (second < 10 ? ('0' + second) : second);
}
标签:10,hour,mm,var,ss,second,date,MM,minute
From: https://www.cnblogs.com/Fantasyfzg/p/17027092.html