HomeRegex LibraryISO 8601 UTC / Timestamp Regex
100% Client-Side β€’ 0 B Data Leaves Browser
formatting

ISO 8601 UTC / Timestamp Regex

Matches standard ISO 8601 and RFC 3339 formatted timestamps including millisecond precision and UTC/timezone offsets.

Regular Expression Pattern:
/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/
Valid Match Example:
2026-09-20T02:45:00.000Z
Invalid / Non-Match Example:
2026-09-20 02:45:00

Regex Syntax Breakdown & Explanation

  • β€’^\d{4}-\d{2}-\d{2} : YYYY-MM-DD calendar date components
  • β€’T : Literal delimiter separating date from time
  • β€’\d{2}:\d{2}:\d{2} : Hour, minute, and second values
  • β€’(?:\.\d+)? : Optional millisecond fractions
  • β€’(?:Z|[+-]\d{2}:\d{2})$ : UTC indicator (Z) or explicit timezone delta

Implementation in Popular Languages

JavaScript / TypeScript
const regex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/;
const isValid = regex.test("2026-09-20T02:45:00.000Z");
console.log(isValid); // true
Python (re)
import re

pattern = r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$"
match = re.match(pattern, "2026-09-20T02:45:00.000Z")
print(bool(match)) # True
Go (regexp)
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})$`)
  fmt.Println(re.MatchString("2026-09-20T02:45:00.000Z"))
}
Frequently Asked Questions

Frequently Asked Questions

Everything you need to know regarding specifications, syntax, and security best practices.

The regular expression pattern is /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/. Matches standard ISO 8601 and RFC 3339 formatted timestamps including millisecond precision and UTC/timezone offsets.