ISO 8601 Date
Matches a date in YYYY-MM-DD format.
Use this for the basic shape of an ISO calendar date, then parse it to verify that the day exists.
regexdateiso 8601
Find
^\d{4}-\d{2}-\d{2}$Find pattern (regex)
^\d{4}-\d{2}-\d{2}$This pattern checks the format only. It will accept impossible dates such as 2026-02-31, so use a date parser for full validation.
The anchors are load-bearing: without ^ and $ the pattern matches the date inside 12026-09-181. It also accepts years like 0000 and never validates leap years; a calendar-correct month/day check needs separate month-length branches.
Common mistakes
- Assuming a format match proves a valid calendar date.
- Mixing local dates with timestamps and time zones.
Related