function getDayOfWeek('년월일') {
const week = ['일', '월', '화', '수', '목', '금', '토'];
const dayOfWeek = week[new Date('년월일').getDay()];
return dayOfWeek;
};
function getNewDate(date) {
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
month = month >= 10 ? month : "0" + month;
day = day >= 10 ? day : "0" + day;
return year + "-" + month + "-" + day;
};
function getNewTime(time) {
let hour = time.getHours();
let minute = time.getMinutes();
hour = hour >= 10 ? hour : "0" + hour;
minute = minute >= 10 ? minute : "0" + minute;
return hour + ":" + minute;
};
const newDate = new Date();
const whatDate = getNewDate(newDate);
const whatTime = getNewTime(newDate);
console.log(whatDate, whatTime);