JS/jQuery - 현재시간(년/월/일/시/분/초) : Date() 함수
2023. 12. 23.
목차

new Date()
JavaScript는 1970년 1월 1일부터 날짜를 밀리초로 저장합니다.
현재 날짜와 시간을 사용하여 날짜 객체를 생성합니다.
new Date(); new Date(milliseconds); new Date(dateString); new Date(year, month, day, hours, minutes, seconds, milliseconds);
예시
메소드
getFullYear() | 연도를 반환합니다. |
---|---|
getMonth() | 월을 반환합니다. (0 ~ 11) |
getDate() | 해당 월의 날짜를 반환합니다. (1 ~ 31) |
getHours() | 시간을 반환합니다. (0 ~ 23) |
getMinutes() | 분을 반환합니다. (0 ~ 59) |
getSeconds() | 초를 반환합니다. (0 ~ 59) |
slice() | 문자열의 일부를 추출합니다. 추출된 부분을 새 문자열로 반환합니다. |
domain_verification Source
JavaScript Date Reference
W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.
www.w3schools.com