[JavaScript] 현재 날짜와 시간 함수 사용법 new Date() - 년, 월, 일, 시, 분, 초
[JavaScript] 현재 날짜와 시간 함수 사용법 new Date() - 년, 월, 일, 시, 분, 초 설명없이 바로 코드로 보여드리겠습니다 !! let now = new Date(); // 현재 날짜 및 시간 let year = now.getFullYear();// 연도 let month = now.getMonth();// 월 let date = now.getDate();// 일 let day = now.getDay(); // 요일 let hours = now.getHours();// 시간 let minutes = now.getMinutes();// 분 let seconds = now.getSeconds();// 초 new Date()로 객체를 생성 후 원하는 것들을 get으로 가져오시면 됩니다 :)
2022. 2. 8.