현재기준 년도를 출력하는 함수
월을 출력하는 함수.
단, 월은 0부터 시작이므므로 출력값을 설정할때 +1을 해줘야 한다.
날짜를 출력하는 함수.
요일을 출력하는 함수.
월요일 = 1, 화요일 = 2 ...
// 작성일: 2022년 06월 18일 (토)
var date = new Date();
console.log(date.getFullYear());
// 결과: "2022"
console.log(date.getMonth()+1 +"월");
// 결과: "6월"
console.log(date.getDate());
// 결과: "18"
console.log(date.getDay());
// 결과: "6"
자바스크립트 | 오늘 날짜 구하기 getFullYear(), getMonth(), getDate(), getDay()