WEB/JS
[javascript] 날짜 가져오기
나나나나나나나ㅏ나난ㄴ나ㅏ나나
2020. 1. 6. 14:09
728x90
var today = new Date();
var date = today.getDate();
var month = today.getMonth()+1; //January is 0!
var year = today.getFullYear();
if(date<10) {
date='0'+date
}
if(month<10) {
month='0'+month
}
console.log(`${year}년 ${month}월 ${date}일`);
728x90