js修改时间格式函数
export function getNowFormatDate(data) { var date = new Date(data) var seperator1 = '/' var seperator2 = ':' var month = date.getMonth() + 1 var strDate = date.getDate() if (month >= 1 && month <= 9) { month = '0' + month } if (strDate >= 0 && strDate <= 9) { strDate = '0' + strDate } var currentdate = date.getFullYear() + seperator1 + prefixZero(month, 2) + seperator1 + prefixZero(strDate, 2) + ' ' + prefixZero(date.getHours(), 2) + seperator2 + prefixZero(date.getMinutes(), 2) + seperator2 + prefixZero(date.getSeconds(), 2) return currentdate } function prefixZero(num, n) { return (Array(n).join(0) + num).slice(-n) }