ISO 8601 Date-Time
Match full ISO 8601 date-times with timezone offset or Z suffix (e.g. 2024-01-15T14:30:00Z).
Try it in RegexPro →Available in
JavaScript / ECMAScript code
const re = new RegExp("\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?(?:Z|[+\\-]\\d{2}:?\\d{2})", "g");
const input = "2024-01-15T14:30:00Z";
const matches = [...input.matchAll(re)];
console.log(matches.map(m => m[0]));Uses `String.prototype.matchAll` for global iteration (Node 12+ / all modern browsers).
Python (re) code
import re
pattern = re.compile(r"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+\-]\d{2}:?\d{2})")
input_text = "2024-01-15T14:30:00Z"
for m in pattern.finditer(input_text):
print(m.group(0))Stdlib `re` module — no third-party dependency. Works on Python 3.6+.
Go (RE2) code
package main
import (
"fmt"
"regexp"
)
func main() {
re := regexp.MustCompile(`\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+\-]\d{2}:?\d{2})`)
input := `2024-01-15T14:30:00Z`
for _, match := range re.FindAllString(input, -1) {
fmt.Println(match)
}
}Uses `regexp.MustCompile` (panics on bad patterns at startup) and `FindAllString` for all matches.
Pattern
\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+\-]\d{2}:?\d{2}) (flags: g)Raw source: \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+\-]\d{2}:?\d{2})
How it works
Examples
Input
2024-01-15T14:30:00ZMatches
2024-01-15T14:30:00Z
Input
2024-03-01T09:00:00.123+05:30Matches
2024-03-01T09:00:00.123+05:30
Input
2024-01-15No match
—Common use cases
- •API response parsing
- •Structured log ingestion
- •Audit event timestamp extraction
- •Cross-timezone analytics
Related patterns
ISO 8601 Date
Dates & TimesMatch dates in ISO 8601 format: YYYY-MM-DD with valid month (01–12) and day (01–31) ranges.
12-Hour Time with AM/PM
Dates & TimesMatch 12-hour time formats with AM or PM suffix — e.g. 9:30 AM, 11:45:15 pm.
24-Hour Time
Dates & TimesMatch 24-hour time formats HH:MM or HH:MM:SS with valid hour (00–23) and minute/second (00–59) ranges.
European Date Format (DD/MM/YYYY)
Dates & TimesMatch European-style dates in DD/MM/YYYY format with valid day (01–31) and month (01–12) ranges.