toIso8601DateTime.php
Table of Contents
Functions
- toIso8601DateTime() : string
- Converts a DateTimeInterface object to its ISO 8601 date-time string.
Functions
toIso8601DateTime()
Converts a DateTimeInterface object to its ISO 8601 date-time string.
toIso8601DateTime(DateTimeInterface $dt[, string $precision = TimePrecision::SECONDS ][, bool $zulu = false ]) : string
Output shape:
YYYY-MM-DDTHH:MM:SS[.fff...]Zwhen offset is zeroYYYY-MM-DDTHH:MM:SS[.fff...]±HH:MMotherwise
The offset is normalized to ±HH:MM (or Z for UTC) regardless of the
underlying timezone object, mirroring the behavior of toIso8601Time().
Parameters
- $dt : DateTimeInterface
-
The date-time to convert
- $precision : string = TimePrecision::SECONDS
-
One of the TimePrecision constants (default: TimePrecision::SECONDS)
- $zulu : bool = false
-
If true, the value is first converted to UTC and rendered with the
Zsuffix (default: false)
Tags
Return values
string —The ISO 8601 date-time string