isIso8601Date.php
Table of Contents
Functions
- isIso8601Date() : bool
- Validates whether a string is a valid ISO 8601 calendar date.
Functions
isIso8601Date()
Validates whether a string is a valid ISO 8601 calendar date.
isIso8601Date(string $date[, bool $strict = false ]) : bool
Accepted formats:
- Extended:
YYYY-MM-DD(e.g. "2026-05-14") - Basic :
YYYYMMDD(e.g. "20260514"), unless$strictis true
The function checks both the syntactic format and the calendar validity (i.e. February 30 is rejected, leap years are honored).
Parameters
- $date : string
-
The date string to validate
- $strict : bool = false
-
If true, only the extended format
YYYY-MM-DDis accepted (default: false)
Tags
Return values
bool —True if the string is a valid ISO 8601 date, false otherwise