Skip to main content
Data & Formatting · In-Browser Regular Expression Lab

ISO 8601 DateTime Regex — Full UTC and Timezone Offset Formats

Matches ISO 8601 timestamps like 2026-10-14T22:30:00.000Z or with +/- timezone offsets.

Flags:
//none
Match Found
Load Sample:
Match Inspection & Details1 match
Match #1:2026-10-14T22:30:00Z

Test Samples Verification Matrix

Expected Valid Samples (Should Match)

2026-10-14T22:30:00Z Pass
2026-10-14T15:00:00.123+01:00 Pass
2024-01-01T00:00:00.000Z Pass

Expected Invalid Samples (Must Reject)

2026-10-14 22:30:00 Rejected (Pass)
2026-10-14T22:30:00 Rejected (Pass)
2026-10-14T25:00:00Z Accepted (Fail)
Code Implementation Generator
// JavaScript / TypeScript (ES6+)
const pattern = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/;
const text = "2026-10-14T22:30:00Z";

const isMatch = pattern.test(text);
console.log("Is Match:", isMatch);

if (isMatch) {
  const matches = text.match(pattern);
  console.log("Matches:", matches);
}

Regular Expression Token Breakdown

Matches complete calendar date, literal 'T', time, optional fractional milliseconds, and UTC 'Z' or offset. Each component of the regular expression serves a distinct syntactical purpose as mapped below:

Token PatternName / ComponentFunction & Rule
\d{4}-\d{2}-\d{2}DateYear, month, and day.
TSeparatorISO date-time delimiter.
\d{2}:\d{2}:\d{2}TimeHours, minutes, seconds.
(?:\.\d+)?MillisecondsOptional fractional seconds.
(?:Z|[+-]\d{2}:\d{2})TimezoneUTC marker 'Z' or explicit offset like +02:00.

Frequently Asked Questions

Is JavaScript Date.prototype.toISOString() output compliant?
Yes, this regex directly validates strings generated by toISOString().
Browse All 40 Patterns