hasLiteralZulu.php
Table of Contents
Functions
- hasLiteralZulu() : bool
- Tells whether a date format pattern carries a **literal** `Z`, the ISO-8601 designator for UTC.
Functions
hasLiteralZulu()
Tells whether a date format pattern carries a **literal** `Z`, the ISO-8601 designator for UTC.
hasLiteralZulu(string $format) : bool
A pattern ending on an escaped Z — 'Y-m-d\TH:i:s.v\Z', the default of
formatDateTime() — asserts that the moment it renders is expressed in UTC.
That is what lets formatDateTime() convert the moment before formatting it, rather
than stamping a wall clock with a suffix that lies about it.
The distinction the naive str_contains( $format , '\Z' ) misses is the escaped
backslash : in '\\\\Z' the backslash escapes a backslash, leaving Z as the native
token for the timezone offset in seconds — not a Zulu designator. Walking the pattern
and stepping over whatever follows an escape tells the two apart.
Parameters
- $format : string
-
A format string compatible with DateTime::format().
Tags
Return values
bool —True when the pattern contains an escaped Z, false otherwise.