Date.prototype.getDate()

getDate() 메서드는 주어진 날짜의 현지 시간 기준 일을 반환합니다.

구문

dateObj.getDate()

반환 값

현지 시간에 따라, 주어진 날짜의 일에 해당하는 1 이상 31 이하의 정수.

예제

getDate() 사용하기

아래 코드의 두 번째 명령문은 Xmas95의 값에 기반하여 day에 2를 할당합니다.

var Xmas95 = new Date('December 25, 1995 23:15:30');
var day = Xmas95.getDate();

console.log(day); // 25

명세

Specification Status Comment
ECMAScript Latest Draft (ECMA-262)
The definition of 'Date.prototype.getDate' in that specification.
Draft  
ECMAScript 2015 (6th Edition, ECMA-262)
The definition of 'Date.prototype.getDate' in that specification.
Standard  
ECMAScript 5.1 (ECMA-262)
The definition of 'Date.prototype.getDate' in that specification.
Standard  
ECMAScript 1st Edition (ECMA-262) Standard Initial definition. Implemented in JavaScript 1.1.

브라우저 호환성

Update compatibility data on GitHub
DesktopMobileServer
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.js
getDateChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support YesSafari Full support YesWebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support 1.0nodejs Full support Yes

Legend

Full support  
Full support

같이 보기