본문 바로가기
카테고리 없음

[Javascript] 시간 날짜 Date / new Date() / getDate()

by 라샐리 2022. 8. 23.
반응형

Date 객체를 사용해서 시간을 측정하고 날짜를 출력할 수 있다

 

new Date()를 인수 없이 부를 경우에는 현재 시간이 출력되는데

이때 밀리초로 이상하게 나온다. 밀리초는 1970년 1월 1일 0시 0분 0초를 기준으로 밀리초로 계산한 값이다

 

 

  1. Date.prototype.getDate()
 

Date.prototype.getDate() - JavaScript | MDN

The getDate() method returns the day of the month for the specified date according to local time.

developer.mozilla.org

 

 

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date

반응형