Files
2nd/10_Wiki/Topic_JavaScript/JavaScript_Dates.md
T
koriweb 9609c04755 docs(10_Wiki): W3Schools 위키화 — HTML/CSS/JavaScript(core)
W3Schools 튜토리얼을 P-Reinforce v3.1 포맷으로 위키화(영어 본문, 한/영 섹션 헤더).
- Topic_HTML: 59문서 (튜토리얼+예제, 레퍼런스/메타 제외)
- Topic_CSS: 190문서 (메인 + Advanced/Flexbox/Grid/RWD 전체)
- Topic_JavaScript: 120문서 (코어 언어; Temporal/DOM상세/BOM/WebAPI/AJAX/jQuery/Graphics 등은 후속)
각 폴더 00_INDEX.md(MOC) 포함. 코드 verbatim, 미확인분은 "Not found in source" 표기.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 19:21:18 +09:00

5.9 KiB
Raw Blame History

id, title, category, status, verification_status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, created_at, updated_at, review_reason, merge_history, tags, raw_sources, applied_in, github_commit
id title category status verification_status canonical_id aliases duplicate_of source_trust_level confidence_score created_at updated_at review_reason merge_history tags raw_sources applied_in github_commit
javascript-dates JavaScript Dates Frontend draft conceptual
Date object
new Date
Date.now
date constructor
JS dates
B 0.89 2026-06-23 2026-06-23
javascript
js
web
frontend
w3schools
date
time
https://www.w3schools.com/js/js_dates.asp

JavaScript Dates

🎯 한 줄 통찰 (One-line insight)

JavaScript dates are created with new Date() in several argument forms (none, a date string, 27 numbers, or milliseconds since the 1970 epoch), and months are counted from 0 (January) to 11 (December). [S1]

🧠 핵심 개념 (Core concepts)

  • new Date() creates a date object with the current date and time. [S1]
  • new Date(date string) creates a date from a date string. [S1]
  • new Date(year, month, ...) creates a date from numeric components (year, month, day, hours, minutes, seconds, milliseconds). [S1]
  • new Date(milliseconds) creates a date as milliseconds since January 1, 1970 (the epoch / zero time). [S1]
  • Months are zero-indexed — January = 0, December = 11. [S1]
  • Date objects are static — the computer time is ticking, but the date object, once created, is not. [S1]

🧩 추출된 패턴 (Extracted patterns)

  • Nownew Date() for current date/time. [S1]
  • From componentsnew Date(year, month, day, ...), remembering month is 0-based. [S1]
  • From epoch msnew Date(ms); new Date(0) is the 1970 epoch. [S1]
  • Display conversionstoString, toDateString, toUTCString, toISOString. [S1]

📖 세부 내용 (Details)

Creating Date Objects — Date objects are created with the new Date() constructor. There are 4 ways to create a new date object: with no arguments, with a date string, with date arguments (numbers), or with milliseconds. [S1]

new Date() — creates a date object with the current date and time: [S1]

const d = new Date();

new Date(date string) — creates a date object from a date string: [S1]

const d = new Date("October 13, 2014 11:13:00");
const d = new Date("2022-03-25");

new Date(year, month, ...) — creates a date object with a specified date and time. 7 numbers specify year, month, day, hour, minute, second, and millisecond (in that order): [S1]

const d = new Date(2018, 11, 24, 10, 33, 30, 0);

6 numbers specify year, month, day, hour, minute, second: [S1]

const d = new Date(2018, 11, 24, 10, 33, 30);

5 numbers specify year, month, day, hour, and minute: [S1]

const d = new Date(2018, 11, 24, 10, 33);

4 numbers specify year, month, day, and hour: [S1]

const d = new Date(2018, 11, 24, 10);

3 numbers specify year, month, and day: [S1]

const d = new Date(2018, 11, 24);

2 numbers specify year and month: [S1]

const d = new Date(2018, 11);

Note: JavaScript counts months from 0 to 11: January = 0. December = 11. [S1]

new Date(milliseconds) — creates a new date object as zero time plus milliseconds. January 01 1970 plus 100 000 000 000 milliseconds is approximately March 03 1973: [S1]

const d = new Date(100000000000);

Negative milliseconds go before 1970: [S1]

const d = new Date(-100000000000);

One day (24 hours) in milliseconds: [S1]

const d = new Date(24 * 60 * 60 * 1000);
// or
const d = new Date(86400000);

Zero time is January 01 1970 00:00:00 UTC: [S1]

const d = new Date(0);

Displaying Dates — JavaScript will (by default) output dates using the toString() method, a string representation of the date including the time zone. Other conversions: [S1]

const d = new Date();
d.toString();
const d = new Date();
d.toDateString();
const d = new Date();
d.toUTCString();
const d = new Date();
d.toISOString();

🛠️ 적용 사례 (Applied in summary)

The page's own snippets are the canonical applied examples — creating "now", a date from a string, a date from 27 numeric components, dates from milliseconds (including new Date(0)), and converting to string formats. No external project/commit applications found in the source.

💻 코드 패턴 (Code patterns)

Current date / from components / from epoch:

const now = new Date();
const dec24 = new Date(2018, 11, 24, 10, 33, 30);  // month 11 = December
const epoch = new Date(0);                          // Jan 01 1970 UTC

Display conversions:

const d = new Date();
d.toDateString();
d.toUTCString();
d.toISOString();

⚖️ 모순 및 업데이트 (Contradictions & updates)

No contradictions found in the source. The source emphasizes the zero-based month convention (January = 0) as a common point of confusion. [S1]

검증 상태 및 신뢰도

  • 상태: draft
  • 검증 단계: conceptual (실제 적용 사례 발견 시 applied/validated로 승격 가능)
  • 출처 신뢰도: B (W3Schools — widely used educational reference, not a primary standards body)
  • 신뢰 점수: 0.89
  • 중복 검사 결과: 신규 생성 (New discovery)

🔗 지식 그래프 (Knowledge Graph)

📚 출처 (Sources)

📝 변경 이력 (Change history)

  • 2026-06-23: Initial draft synthesized from the W3Schools "JavaScript Dates" page (Astra wiki-curation, P-Reinforce v3.1 format).