Date.prototype.getDay()
Baseline
Widely available
This feature is well established and works across many devices and browser versions. Itâs been available across browsers since â¨2015ë 7ìâ©.
getDay() ë©ìëë 주ì´ì§ ë ì§ì íì§ ìê° ê¸°ì¤ ìì¼ì ë°íí©ëë¤. 0ì ì¼ìì¼ì ëíë
ëë¤. íì¬ì ì¼ì ë°ííë ¤ë©´ Date.prototype.getDate()를 ì¬ì©íì¸ì.
ìëí´ ë³´ê¸°
const birthday = new Date("August 19, 1975 23:15:30");
const day1 = birthday.getDay();
// Sunday - Saturday : 0 - 6
console.log(day1);
// Expected output: 2
구문
dateObj.getDay();
ë°í ê°
íì§ ìê°ì ë°ë¼, 주ì´ì§ ë ì§ì ìì¼ì í´ë¹íë 0 ì´ì 6 ì´íì ì ì. (ì¼ìì¼ì 0, ììì¼ì 1, íìì¼ì 2, ...)
ìì
>getDay() ì¬ì©í기
1995ë
12ì 25ì¼ì ììì¼ì
ëë¤. ë°ë¼ì ìë ì½ëì ë ë²ì§¸ ëª
ë ¹ë¬¸ì Xmas95ì ê°ì 기ë°íì¬ weekdayì 1ì í ë¹í©ëë¤.
var Xmas95 = new Date("December 25, 1995 23:15:30");
var weekday = Xmas95.getDay();
console.log(weekday); // 1
ì°¸ê³ :
ì°¸ê³ : íìíë¤ë©´, ìì¼ì ì´ë¦("ììì¼" ë±)ì Intl.DateTimeFormatê³¼ options 매ê°ë³ì를 ì¬ì©í´ ì»ì ì ììµëë¤. ì´ ë°©ë²ì ì¬ì©íë©´ êµì íë ë ì¬ìì§ëë¤.```js
var options = { weekday: 'long'};
console.log(new Intl.DateTimeFormat('en-US', options).format(Xmas95));
// Monday
console.log(new Intl.DateTimeFormat('ko-KR', options).format(Xmas95));
// ììì¼
ëª ì¸
| Specification |
|---|
| ECMAScript® 2026 Language Specification > # sec-date.prototype.getday > |