Create date validation patterns for ISO 8601, US, EU, UK

Check whether text follows a zero-padded ISO-style calendar date shape.

freeworks offlinenothing uploaded
ToolDate Regex
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

The pattern matches a selected layout such as YYYY-MM-DD with fixed separators and digit counts. It checks lexical shape only; a date parser is needed for leap days and month lengths.

  • Year-month-day order avoids locale ambiguity.
  • Zero padding makes valid dates sort lexically.

Worked example

ISO 8601 date format validation (YYYY-MM-DD)
Get the regex pattern for ISO 8601 date format (YYYY-MM-DD)
Input
											iso
										
Output
												Date Regex (iso):

^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])$

ISO 8601 date format (YYYY-MM-DD)

Examples:
  2024-01-15
  2023-12-31
											

When to use this

API fields, date-prefixed filenames, and log filters check ISO date text.

Edge cases

  • 2024-02-30 has the right shape but is not a calendar date.
  • Single-digit months fail a zero-padded pattern.
  • Timezone suffixes require a date-time expression.

References