Oihana PHP

DateFormat

Defines the canonical date/time format patterns of the library.

Using these constants instead of the raw pattern strings keeps the producers in sync — for instance the default format shared by formatDateTime() and now().

Tags
example
use oihana\core\date\DateFormat;
use function oihana\core\date\formatDateTime;

echo formatDateTime( '2025-07-20T09:30:00+02:00' , format : DateFormat::ZULU_MILLI ) ; // 2025-07-20T07:30:00.000Z
author

Marc Alcaraz (ekameleon)

since
1.2.0

Table of Contents

Constants

DEFAULT  : string = self::ZULU_MILLI
The format used by {@see formatDateTime()} and {@see now()} when none is given.
ZULU_MILLI  : string = 'Y-m-d\TH:i:s.v\Z'
ISO-8601 in UTC, with milliseconds and a literal `Z` suffix — e.g. `2025-07-20T07:30:00.000Z`.

Constants

DEFAULT

The format used by {@see formatDateTime()} and {@see now()} when none is given.

public string DEFAULT = self::ZULU_MILLI

Type: string

ZULU_MILLI

ISO-8601 in UTC, with milliseconds and a literal `Z` suffix — e.g. `2025-07-20T07:30:00.000Z`.

public string ZULU_MILLI = 'Y-m-d\TH:i:s.v\Z'

The Z is escaped, hence a literal : formatDateTime() converts the moment to UTC before formatting, so that the suffix tells the truth.

Type: string

On this page

Search results