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>
This commit is contained in:
@@ -0,0 +1,140 @@
|
||||
---
|
||||
id: javascript-date-formats
|
||||
title: "JavaScript Date Formats"
|
||||
category: "Frontend"
|
||||
status: "draft"
|
||||
verification_status: "conceptual"
|
||||
canonical_id: ""
|
||||
aliases: ["date formats", "ISO date", "Date.parse", "date string", "date input formats"]
|
||||
duplicate_of: ""
|
||||
source_trust_level: "B"
|
||||
confidence_score: 0.88
|
||||
created_at: 2026-06-23
|
||||
updated_at: 2026-06-23
|
||||
review_reason: ""
|
||||
merge_history: []
|
||||
tags: ["javascript", "js", "web", "frontend", "w3schools", "date", "format"]
|
||||
raw_sources: ["https://www.w3schools.com/js/js_date_formats.asp"]
|
||||
applied_in: []
|
||||
github_commit: ""
|
||||
---
|
||||
|
||||
# [[JavaScript Date Formats]]
|
||||
|
||||
## 🎯 한 줄 통찰 (One-line insight)
|
||||
JavaScript accepts dates as ISO, Short, Long, and Full date strings; ISO is the preferred unambiguous format, and `Date.parse()` converts a valid date string into milliseconds since the epoch. [S1]
|
||||
|
||||
## 🧠 핵심 개념 (Core concepts)
|
||||
- **Four input formats** — JavaScript date input can be given as ISO, Short, Long, or Full date strings. [S1]
|
||||
- **ISO format (YYYY-MM-DD)** is the preferred JavaScript date format and is the most reliable. [S1]
|
||||
- **Partial ISO dates** are allowed — year and month (`"2015-03"`) or just year (`"2015"`). [S1]
|
||||
- **ISO date-time** can include a `T` and time, with `Z` for UTC or an offset like `-06:30`. [S1]
|
||||
- **Short / Long dates** use formats like `"03/25/2015"` or `"Mar 25 2015"`. [S1]
|
||||
- **`Date.parse()`** parses a valid date string and returns the number of milliseconds since January 1, 1970. [S1]
|
||||
|
||||
## 🧩 추출된 패턴 (Extracted patterns)
|
||||
- **Prefer ISO** — use `"YYYY-MM-DD"` for unambiguous parsing. [S1]
|
||||
- **UTC vs local** — append `Z` for UTC, or an offset to specify a time zone. [S1]
|
||||
- **String → ms** — `Date.parse(str)`, then optionally `new Date(msec)` to build a Date. [S1]
|
||||
|
||||
## 📖 세부 내용 (Details)
|
||||
**Date Input Formats** — There are generally 4 types of JavaScript date input formats: ISO Date, Short Date, Long Date, and Full Date. The ISO format follows a strict standard in JavaScript and is the preferred format. [S1]
|
||||
|
||||
**ISO Dates** — A complete ISO date (YYYY-MM-DD): [S1]
|
||||
```javascript
|
||||
const d = new Date("2015-03-25");
|
||||
```
|
||||
ISO date without day (year and month): [S1]
|
||||
```javascript
|
||||
const d = new Date("2015-03");
|
||||
```
|
||||
ISO date with only year: [S1]
|
||||
```javascript
|
||||
const d = new Date("2015");
|
||||
```
|
||||
ISO date-time with UTC (`Z`): [S1]
|
||||
```javascript
|
||||
const d = new Date("2015-03-25T12:00:00Z");
|
||||
```
|
||||
ISO date-time with a time-zone offset: [S1]
|
||||
```javascript
|
||||
const d = new Date("2015-03-25T12:00:00-06:30");
|
||||
```
|
||||
|
||||
**Short Dates** — short dates are written with an MM/DD/YYYY syntax: [S1]
|
||||
```javascript
|
||||
const d = new Date("03/25/2015");
|
||||
```
|
||||
|
||||
**Long Dates** — long dates are most often written with a "MMM DD YYYY" syntax: [S1]
|
||||
```javascript
|
||||
const d = new Date("Mar 25 2015");
|
||||
```
|
||||
The month and day can be in any order: [S1]
|
||||
```javascript
|
||||
const d = new Date("25 Mar 2015");
|
||||
```
|
||||
The month can be written in full (January), or abbreviated (Jan): [S1]
|
||||
```javascript
|
||||
const d = new Date("January 25 2015");
|
||||
```
|
||||
```javascript
|
||||
const d = new Date("Jan 25 2015");
|
||||
```
|
||||
Commas are ignored, and names are case insensitive: [S1]
|
||||
```javascript
|
||||
const d = new Date("JANUARY, 25, 2015");
|
||||
```
|
||||
|
||||
**Date.parse()** — `Date.parse()` parses a date string and returns the number of milliseconds between the date and January 1, 1970: [S1]
|
||||
```javascript
|
||||
let msec = Date.parse("March 21, 2012");
|
||||
```
|
||||
The result can then be used to create a Date object: [S1]
|
||||
```javascript
|
||||
let msec = Date.parse("March 21, 2012");
|
||||
const d = new Date(msec);
|
||||
```
|
||||
|
||||
## 🛠️ 적용 사례 (Applied in summary)
|
||||
The page's own snippets are the canonical applied examples — building dates from ISO, short, and long strings, including UTC and time-zone-offset variants, and converting a date string to milliseconds with `Date.parse()`. No external project/commit applications found in the source.
|
||||
|
||||
## 💻 코드 패턴 (Code patterns)
|
||||
Preferred ISO date:
|
||||
```javascript
|
||||
const d = new Date("2015-03-25");
|
||||
```
|
||||
ISO date-time, UTC vs offset:
|
||||
```javascript
|
||||
const utc = new Date("2015-03-25T12:00:00Z");
|
||||
const offset = new Date("2015-03-25T12:00:00-06:30");
|
||||
```
|
||||
Parse a string to ms, then to a Date:
|
||||
```javascript
|
||||
let msec = Date.parse("March 21, 2012");
|
||||
const d = new Date(msec);
|
||||
```
|
||||
|
||||
## ⚖️ 비교 및 선택 기준 (Comparison & decision criteria)
|
||||
- **ISO vs Short vs Long** — ISO (`YYYY-MM-DD`) is the preferred, strict, and most reliable format; Short (`MM/DD/YYYY`) and Long (`MMM DD YYYY`) are more permissive but ambiguous (month/day order can vary). Prefer ISO for unambiguous parsing. [S1]
|
||||
|
||||
## ⚖️ 모순 및 업데이트 (Contradictions & updates)
|
||||
No contradictions found in the source. The source advises ISO as the preferred and most reliable format over the more permissive Short/Long forms. [S1]
|
||||
|
||||
## ✅ 검증 상태 및 신뢰도
|
||||
- **상태:** draft
|
||||
- **검증 단계:** conceptual (실제 적용 사례 발견 시 applied/validated로 승격 가능)
|
||||
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
|
||||
- **신뢰 점수:** 0.88
|
||||
- **중복 검사 결과:** 신규 생성 (New discovery)
|
||||
|
||||
## 🔗 지식 그래프 (Knowledge Graph)
|
||||
- **상위/루트:** [[JavaScript Tutorial]]
|
||||
- **관련 개념:** [[JavaScript Dates]], [[JavaScript Date Methods]], [[JavaScript Date Get Methods]]
|
||||
- **참조 맥락:** Referenced whenever a date string must be parsed or formatted for the Date constructor.
|
||||
|
||||
## 📚 출처 (Sources)
|
||||
- [S1] W3Schools — JavaScript Date Formats — https://www.w3schools.com/js/js_date_formats.asp
|
||||
|
||||
## 📝 변경 이력 (Change history)
|
||||
- 2026-06-23: Initial draft synthesized from the W3Schools "JavaScript Date Formats" page (Astra wiki-curation, P-Reinforce v3.1 format).
|
||||
Reference in New Issue
Block a user