Property | Type | Description | |
---|---|---|---|
$_lastErrors | array | Holds the last error generated by createFromFormat |
Method | Description | |
---|---|---|
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, DateTimeZon\DateTimeZone | string | null $tz = null ) : static | Create a new ChronosInterface instance from a specific date and time. | |
createFromDate ( integer $year = null, integer $month = null, integer $day = null, DateTimeZon\DateTimeZone | string | null $tz = null ) : static | Create a ChronosInterface instance from just a date. The time portion is set to now. | |
createFromFormat ( string $format, string $time, DateTimeZon\DateTimeZone | string | null $tz = null ) : static | Create a ChronosInterface instance from a specific format | |
createFromTime ( integer | null $hour = null, integer | null $minute = null, integer | null $second = null, DateTimeZon\DateTimeZone | string | null $tz = null ) : static | Create a ChronosInterface instance from just a time. The date portion is set to today. | |
createFromTimestamp ( integer $timestamp, DateTimeZon\DateTimeZone | string | null $tz = null ) : static | Create a ChronosInterface instance from a timestamp | |
createFromTimestampUTC ( integer $timestamp ) : static | Create a ChronosInterface instance from an UTC timestamp | |
getLastErrors ( ) : array | Returns any errors or warnings that were found during the parsing of the last object created by this class. | |
instance ( DateTimeInterface $dt ) : static | Create a ChronosInterface instance from a DateTimeInterface one | |
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. | |
now ( DateTimeZon\DateTimeZone | string | null $tz = null ) : static | Get a ChronosInterface instance for the current date and time | |
parse ( string $time = 'now', DateTimeZon\DateTimeZone | string | null $tz = null ) | 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() | |
today ( DateTimeZon\DateTimeZone | string | null $tz = null ) : static | Create a ChronosInterface instance for today | |
tomorrow ( DateTimeZon\DateTimeZone | string | null $tz = null ) : static | Create a ChronosInterface instance for tomorrow | |
yesterday ( DateTimeZon\DateTimeZone | string | null $tz = null ) : static | Create a ChronosInterface instance for yesterday |
Method | Description | |
---|---|---|
safeCreateDateTimeZone ( DateTimeZon\DateTimeZone | string | null $object ) : DateTimeZone | Creates a DateTimeZone from a string or a DateTimeZone |
public static 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, DateTimeZon\DateTimeZone | string | null $tz = null ) : static | ||
$year | integer | null | The year to create an instance with. |
$month | integer | null | The month to create an instance with. |
$day | integer | null | The day to create an instance with. |
$hour | integer | null | The hour to create an instance with. |
$minute | integer | null | The minute to create an instance with. |
$second | integer | null | The second to create an instance with. |
$tz | DateTimeZon\DateTimeZone | string | null | The DateTimeZone object or timezone name the new instance should use. |
return | static |
public static createFromDate ( integer $year = null, integer $month = null, integer $day = null, DateTimeZon\DateTimeZone | string | null $tz = null ) : static | ||
$year | integer | The year to create an instance with. |
$month | integer | The month to create an instance with. |
$day | integer | The day to create an instance with. |
$tz | DateTimeZon\DateTimeZone | string | null | The DateTimeZone object or timezone name the new instance should use. |
return | static |
public static createFromFormat ( string $format, string $time, DateTimeZon\DateTimeZone | string | null $tz = null ) : static | ||
$format | string | The date() compatible format string. |
$time | string | The formatted date string to interpret. |
$tz | DateTimeZon\DateTimeZone | string | null | The DateTimeZone object or timezone name the new instance should use. |
return | static |
public static createFromTime ( integer | null $hour = null, integer | null $minute = null, integer | null $second = null, DateTimeZon\DateTimeZone | string | null $tz = null ) : static | ||
$hour | integer | null | The hour to create an instance with. |
$minute | integer | null | The minute to create an instance with. |
$second | integer | null | The second to create an instance with. |
$tz | DateTimeZon\DateTimeZone | string | null | The DateTimeZone object or timezone name the new instance should use. |
return | static |
public static createFromTimestamp ( integer $timestamp, DateTimeZon\DateTimeZone | string | null $tz = null ) : static | ||
$timestamp | integer | The timestamp to create an instance from. |
$tz | DateTimeZon\DateTimeZone | string | null | The DateTimeZone object or timezone name the new instance should use. |
return | static |
public static createFromTimestampUTC ( integer $timestamp ) : static | ||
$timestamp | integer | The UTC timestamp to create an instance from. |
return | static |
public static getLastErrors ( ) : array | ||
return | array |
public static instance ( DateTimeInterface $dt ) : static | ||
$dt | DateTimeInterface | The datetime instance to convert. |
return | static |
public static maxValue ( ) : Cake\Chronos\ChronosInterface | ||
return | Cake\Chronos\ChronosInterface |
public static minValue ( ) : Cake\Chronos\ChronosInterface | ||
return | Cake\Chronos\ChronosInterface |
protected static safeCreateDateTimeZone ( DateTimeZon\DateTimeZone | string | null $object ) : DateTimeZone | ||
$object | DateTimeZon\DateTimeZone | string | null | The value to convert. |
return | DateTimeZone |
protected static array $_lastErrors | ||
return | array |