const getDate = function(date) { const hours = date.getHours(); const minutes = date.getMinutes(); const seconds = date.getSeconds(); const h = hours > 9 ? hours : "0" + hours; const m = minutes > 9 ? minutes : "0" + minutes; const s = seconds > 9 ? seconds : "0" + seconds; const month = date.getMonth(); const mon = month > 8 ? month + 1 : "0" + month; const da = date.getDate(); const dt = da > 9 ? da : "0" + da; return `${date.getFullYear()}-${mon}-${dt} ${h}:${m}:${s}`; }