DateTrait
trait DateTrait (View source)
Shared code for working with elements which manage dates.
Properties
protected string | $createFromFormat | The format that should be used when determining how to parse a date from a date string. | |
protected string | $outputTimezone | The preferred timezone to use for date output. |
Methods
setDateFormat(string $createFromFormat)
Allows the user to help the date parser by providing the format of the datestamp in the feed.
setOutputTimezone(string $timezone = 'UTC')
Set the preferred output timezone.
Details
at line 41
DateTrait
setDateFormat(string $createFromFormat)
Allows the user to help the date parser by providing the format of the datestamp in the feed.
This will be passed into DateTime::createFromFormat()
at parse-time.
at line 61
DateTrait
setOutputTimezone(string $timezone = 'UTC')
Set the preferred output timezone.
This calculation is performed on a best-effort basis and is not guaranteed. Factors which may affect the calculation include:
- the version of glibc/musl that your OS relies on
- the freshness of the timestamp data your OS relies on
- the format of the datestamp inside of the feed and PHP's ability to parse it