Date.prototype.getDate()
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
getDate()
메서드는 주어진 날짜의 현지 시간 기준 일을 반환합니다.
시도해보기
const birthday = new Date("August 19, 1975 23:15:30");
const date1 = birthday.getDate();
console.log(date1);
// Expected output: 19
구문
js
dateObj.getDate();
반환 값
현지 시간에 따라, 주어진 날짜의 일에 해당하는 1 이상 31 이하의 정수.
예제
getDate()
사용하기
아래 코드의 두 번째 명령문은 Xmas95
의 값에 기반하여 day
에 2를 할당합니다.
js
var Xmas95 = new Date("December 25, 1995 23:15:30");
var day = Xmas95.getDate();
console.log(day); // 25
명세
Specification |
---|
ECMAScript® 2025 Language Specification # sec-date.prototype.getdate |
브라우저 호환성
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
getDate |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.