toIso8601Time.php
Table of Contents
Functions
- toIso8601Time() : string
- Converts a DateTimeInterface object to its ISO 8601 time string representation.
Functions
toIso8601Time()
Converts a DateTimeInterface object to its ISO 8601 time string representation.
toIso8601Time(DateTimeInterface $time) : string
This function generates a normalized ISO 8601 time string from any PHP DateTimeInterface
object (DateTime or DateTimeImmutable). The output format is:
- "THH:MM:SSZ" for UTC (zero offset)
- "THH:MM:SS±HH:MM" for non-zero offsets
The 'T' prefix separates the time from a potential date component, and the timezone designator can be 'Z' for UTC or a ±HH:MM offset.
Parameters
- $time : DateTimeInterface
-
The time to convert to ISO 8601 format
Tags
Return values
string —The ISO 8601 time string, e.g. "T14:30:00Z" or "T08:15:30+02:00"