--- 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).