$_lastErrors
$_lastErrors : array
Holds the last error generated by createFromFormat
Provides a number of datetime related factory methods.
parse(string $time = 'now', \DateTimeZone|string|null $tz = null) : static
Create a ChronosInterface instance from a string. This is an alias for the constructor that allows better fluent syntax as it allows you to do ChronosInterface::parse('Monday next week')->fn() rather than (new Chronos('Monday next week'))->fn()
string | $time | The strtotime compatible string to parse |
\DateTimeZone|string|null | $tz | The DateTimeZone object or timezone name. |
maxValue() : \Cake\Chronos\ChronosInterface
Create a ChronosInterface instance for the greatest supported date.
minValue() : \Cake\Chronos\ChronosInterface
Create a ChronosInterface instance for the lowest supported date.
create(integer|null $year = null, integer|null $month = null, integer|null $day = null, integer|null $hour = null, integer|null $minute = null, integer|null $second = null, \DateTimeZone|string|null $tz = null) : static
Create a new ChronosInterface instance from a specific date and time.
If any of $year, $month or $day are set to null their now() values will be used.
If $hour is null it will be set to its now() value and the default values for $minute and $second will be their now() values. If $hour is not null then the default values for $minute and $second will be 0.
integer|null | $year | The year to create an instance with. |
integer|null | $month | The month to create an instance with. |
integer|null | $day | The day to create an instance with. |
integer|null | $hour | The hour to create an instance with. |
integer|null | $minute | The minute to create an instance with. |
integer|null | $second | The second to create an instance with. |
\DateTimeZone|string|null | $tz | The DateTimeZone object or timezone name the new instance should use. |
createFromDate(integer $year = null, integer $month = null, integer $day = null, \DateTimeZone|string|null $tz = null) : static
Create a ChronosInterface instance from just a date. The time portion is set to now.
integer | $year | The year to create an instance with. |
integer | $month | The month to create an instance with. |
integer | $day | The day to create an instance with. |
\DateTimeZone|string|null | $tz | The DateTimeZone object or timezone name the new instance should use. |
createFromTime(integer|null $hour = null, integer|null $minute = null, integer|null $second = null, \DateTimeZone|string|null $tz = null) : static
Create a ChronosInterface instance from just a time. The date portion is set to today.
integer|null | $hour | The hour to create an instance with. |
integer|null | $minute | The minute to create an instance with. |
integer|null | $second | The second to create an instance with. |
\DateTimeZone|string|null | $tz | The DateTimeZone object or timezone name the new instance should use. |
createFromFormat(string $format, string $time, \DateTimeZone|string|null $tz = null) : static
Create a ChronosInterface instance from a specific format
string | $format | The date() compatible format string. |
string | $time | The formatted date string to interpret. |
\DateTimeZone|string|null | $tz | The DateTimeZone object or timezone name the new instance should use. |
createFromTimestamp(integer $timestamp, \DateTimeZone|string|null $tz = null) : static
Create a ChronosInterface instance from a timestamp
integer | $timestamp | The timestamp to create an instance from. |
\DateTimeZone|string|null | $tz | The DateTimeZone object or timezone name the new instance should use. |
Loading…