Skip to main content
Regexflux

ISO 8601 Date

beginner

Matches dates in YYYY-MM-DD format following ISO 8601.

dateisoformatvalidation

Pattern

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

Try It

0 of 7 strings matched

Explanation

Matches 4-digit year, followed by month (01-12) and day (01-31) separated by hyphens. Does not validate month-day combinations (e.g., Feb 31 passes).

Test Strings

Matching

  • 2024-01-15
  • 2023-12-31
  • 1999-06-30

Non-matching

  • 2024-13-01
  • 2024-00-15
  • 24-01-15
  • 2024/01/15

Language Compatibility

LanguageSupport
JSFull support
PYTHONFull support
JAVAFull support
PHPFull support
GOFull support

Code Snippets

const regex = /\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])/g;
const text = "your text here";
const matches = text.match(regex);
console.log(matches);

Common Variations

With slashes

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

YYYY/MM/DD format

Related Patterns