DateTrait
Provides shared defaults (date format and timezone) for classes manipulating dates.
Tags
Table of Contents
Constants
- DEFAULT_DATE_FORMAT : string = 'Y-m-d\TH:i:s'
- The default date format (ISO-8601, no offset).
- DEFAULT_TIMEZONE : string = 'Europe/Paris'
- The default timezone identifier used when none is configured.
- NOW : string = 'now'
- Sentinel value commonly used to denote the current date/time.
Properties
- $dateFormat : string
- The date format used by the consuming class.
- $timezone : string|null
- The timezone identifier used by the consuming class, or `null` to fall back to PHP's default.
Constants
DEFAULT_DATE_FORMAT
The default date format (ISO-8601, no offset).
public
string
DEFAULT_DATE_FORMAT
= 'Y-m-d\TH:i:s'
DEFAULT_TIMEZONE
The default timezone identifier used when none is configured.
public
string
DEFAULT_TIMEZONE
= 'Europe/Paris'
NOW
Sentinel value commonly used to denote the current date/time.
public
string
NOW
= 'now'
Properties
$dateFormat
The date format used by the consuming class.
public
string
$dateFormat
= self::DEFAULT_DATE_FORMAT
$timezone
The timezone identifier used by the consuming class, or `null` to fall back to PHP's default.
public
string|null
$timezone
= self::DEFAULT_TIMEZONE