MONDAY
MONDAY = 1
The day constants
An extension to the DateTimeInterface for a friendlier API
setDateTime(integer $year, integer $month, integer $day, integer $hour, integer $minute, integer $second) : static
Set the date and time all together
integer | $year | The year to set. |
integer | $month | The month to set. |
integer | $day | The day to set. |
integer | $hour | The hour to set. |
integer | $minute | The minute to set. |
integer | $second | The second to set. |
eq(\Cake\Chronos\ChronosInterface $dt) : boolean
Determines if the instance is equal to another
\Cake\Chronos\ChronosInterface | $dt | The instance to compare with. |
ne(\Cake\Chronos\ChronosInterface $dt) : boolean
Determines if the instance is not equal to another
\Cake\Chronos\ChronosInterface | $dt | The instance to compare with. |
gt(\Cake\Chronos\ChronosInterface $dt) : boolean
Determines if the instance is greater (after) than another
\Cake\Chronos\ChronosInterface | $dt | The instance to compare with. |
gte(\Cake\Chronos\ChronosInterface $dt) : boolean
Determines if the instance is greater (after) than or equal to another
\Cake\Chronos\ChronosInterface | $dt | The instance to compare with. |
lt(\Cake\Chronos\ChronosInterface $dt) : boolean
Determines if the instance is less (before) than another
\Cake\Chronos\ChronosInterface | $dt | The instance to compare with. |
lte(\Cake\Chronos\ChronosInterface $dt) : boolean
Determines if the instance is less (before) or equal to another
\Cake\Chronos\ChronosInterface | $dt | The instance to compare with. |
between(\Cake\Chronos\ChronosInterface $dt1, \Cake\Chronos\ChronosInterface $dt2, boolean $equal = true) : boolean
Determines if the instance is between two others
\Cake\Chronos\ChronosInterface | $dt1 | The instance to compare with. |
\Cake\Chronos\ChronosInterface | $dt2 | The instance to compare with. |
boolean | $equal | Indicates if a > and < comparison should be used or <= or >= |
closest(\Cake\Chronos\ChronosInterface $dt1, \Cake\Chronos\ChronosInterface $dt2) : static
Get the closest date from the instance.
\Cake\Chronos\ChronosInterface | $dt1 | The instance to compare with. |
\Cake\Chronos\ChronosInterface | $dt2 | The instance to compare with. |
farthest(\Cake\Chronos\ChronosInterface $dt1, \Cake\Chronos\ChronosInterface $dt2) : static
Get the farthest date from the instance.
\Cake\Chronos\ChronosInterface | $dt1 | The instance to compare with. |
\Cake\Chronos\ChronosInterface | $dt2 | The instance to compare with. |
min(\Cake\Chronos\ChronosInterface|null $dt = null) : static
Get the minimum instance between a given instance (default now) and the current instance.
\Cake\Chronos\ChronosInterface|null | $dt | The instance to compare with. |
max(\Cake\Chronos\ChronosInterface|null $dt = null) : static
Get the maximum instance between a given instance (default now) and the current instance.
\Cake\Chronos\ChronosInterface|null | $dt | The instance to compare with. |
isSameDay(\Cake\Chronos\ChronosInterface $dt) : boolean
Checks if the passed in date is the same day as the instance current day.
\Cake\Chronos\ChronosInterface | $dt | The instance to check against. |
addMonths(integer $value) : static
Add months to the instance. Positive $value travels forward while negative $value travels into the past.
When adding or subtracting months, if the resulting time is a date that does not exist, the result of this operation will always be the last day of the intended month.
(new Chronos('2015-01-03'))->addMonths(1); // Results in 2015-02-03
(new Chronos('2015-01-31'))->addMonths(1); // Results in 2015-02-28
integer | $value | The number of months to add. |
addMonth(integer $value = 1) : static
Add a month to the instance
When adding or subtracting months, if the resulting time is a date that does not exist, the result of this operation will always be the last day of the intended month.
(new Chronos('2015-01-03'))->addMonth(); // Results in 2015-02-03
(new Chronos('2015-01-31'))->addMonth(); // Results in 2015-02-28
integer | $value | The number of months to add. |
subMonth(integer $value = 1) : static
Remove a month from the instance
When adding or subtracting months, if the resulting time is a date that does not exist, the result of this operation will always be the last day of the intended month.
(new Chronos('2015-03-01'))->subMonth(); // Results in 2015-02-01
(new Chronos('2015-03-31'))->subMonth(); // Results in 2015-02-28
integer | $value | The number of months to remove. |
subMonths(integer $value) : static
Remove months from the instance
When adding or subtracting months, if the resulting time is a date that does not exist, the result of this operation will always be the last day of the intended month.
(new Chronos('2015-03-01'))->subMonths(1); // Results in 2015-02-01
(new Chronos('2015-03-31'))->subMonths(1); // Results in 2015-02-28
integer | $value | The number of months to remove. |
diffForHumans(\Cake\Chronos\ChronosInterface|null $other = null, boolean $absolute = false) : string
Get the difference in a human readable format in the current locale.
When comparing a value in the past to default now: 1 hour ago 5 months ago
When comparing a value in the future to default now: 1 hour from now 5 months from now
When comparing a value in the past to another value: 1 hour before 5 months before
When comparing a value in the future to another value: 1 hour after 5 months after
\Cake\Chronos\ChronosInterface|null | $other | The datetime to compare with. |
boolean | $absolute | Removes time difference modifiers ago, after, etc |
diffInYears(\Cake\Chronos\ChronosInterface|null $dt = null, boolean $abs = true) : integer
Get the difference in years
\Cake\Chronos\ChronosInterface|null | $dt | The instance to difference from. |
boolean | $abs | Get the absolute of the difference |
diffInMonths(\Cake\Chronos\ChronosInterface|null $dt = null, boolean $abs = true) : integer
Get the difference in months
\Cake\Chronos\ChronosInterface|null | $dt | The instance to difference from. |
boolean | $abs | Get the absolute of the difference |
diffInWeeks(\Cake\Chronos\ChronosInterface|null $dt = null, boolean $abs = true) : integer
Get the difference in weeks
\Cake\Chronos\ChronosInterface|null | $dt | The instance to difference from. |
boolean | $abs | Get the absolute of the difference |
diffInDays(\Cake\Chronos\ChronosInterface|null $dt = null, boolean $abs = true) : integer
Get the difference in days
\Cake\Chronos\ChronosInterface|null | $dt | The instance to difference from. |
boolean | $abs | Get the absolute of the difference |
diffInDaysFiltered(callable $callback, \Cake\Chronos\ChronosInterface|null $dt = null, boolean $abs = true) : integer
Get the difference in days using a filter callable
callable | $callback | The callback to use for filtering. |
\Cake\Chronos\ChronosInterface|null | $dt | The instance to difference from. |
boolean | $abs | Get the absolute of the difference |
diffInHoursFiltered(callable $callback, \Cake\Chronos\ChronosInterface|null $dt = null, boolean $abs = true) : integer
Get the difference in hours using a filter callable
callable | $callback | The callback to use for filtering. |
\Cake\Chronos\ChronosInterface|null | $dt | The instance to difference from. |
boolean | $abs | Get the absolute of the difference |
diffFiltered(\Cake\Chronos\ChronosInterval $ci, callable $callback, \Cake\Chronos\ChronosInterface|null $dt = null, boolean $abs = true) : integer
Get the difference by the given interval using a filter callable
\Cake\Chronos\ChronosInterval | $ci | An interval to traverse by |
callable | $callback | The callback to use for filtering. |
\Cake\Chronos\ChronosInterface|null | $dt | The instance to difference from. |
boolean | $abs | Get the absolute of the difference |
diffInWeekdays(\Cake\Chronos\ChronosInterface|null $dt = null, boolean $abs = true) : integer
Get the difference in weekdays
\Cake\Chronos\ChronosInterface|null | $dt | The instance to difference from. |
boolean | $abs | Get the absolute of the difference |
diffInWeekendDays(\Cake\Chronos\ChronosInterface|null $dt = null, boolean $abs = true) : integer
Get the difference in weekend days using a filter
\Cake\Chronos\ChronosInterface|null | $dt | The instance to difference from. |
boolean | $abs | Get the absolute of the difference |
diffInHours(\Cake\Chronos\ChronosInterface|null $dt = null, boolean $abs = true) : integer
Get the difference in hours
\Cake\Chronos\ChronosInterface|null | $dt | The instance to difference from. |
boolean | $abs | Get the absolute of the difference |
diffInMinutes(\Cake\Chronos\ChronosInterface|null $dt = null, boolean $abs = true) : integer
Get the difference in minutes
\Cake\Chronos\ChronosInterface|null | $dt | The instance to difference from. |
boolean | $abs | Get the absolute of the difference |
diffInSeconds(\Cake\Chronos\ChronosInterface|null $dt = null, boolean $abs = true) : integer
Get the difference in seconds
\Cake\Chronos\ChronosInterface|null | $dt | The instance to difference from. |
boolean | $abs | Get the absolute of the difference |
next(integer $dayOfWeek = null) : mixed
Modify to the next occurrence of a given day of the week.
If no dayOfWeek is provided, modify to the next occurrence of the current day of the week. Use the supplied consts to indicate the desired dayOfWeek, ex. static::MONDAY.
integer | $dayOfWeek | The day of the week to move to. |
previous(integer $dayOfWeek = null) : mixed
Modify to the previous occurrence of a given day of the week.
If no dayOfWeek is provided, modify to the previous occurrence of the current day of the week. Use the supplied consts to indicate the desired dayOfWeek, ex. static::MONDAY.
integer | $dayOfWeek | The day of the week to move to. |
firstOfMonth(integer $dayOfWeek = null) : mixed
Modify to the first occurrence of a given day of the week in the current month. If no dayOfWeek is provided, modify to the first day of the current month. Use the supplied consts to indicate the desired dayOfWeek, ex. static::MONDAY.
integer | $dayOfWeek | The day of the week to move to. |
lastOfMonth(integer $dayOfWeek = null) : mixed
Modify to the last occurrence of a given day of the week in the current month. If no dayOfWeek is provided, modify to the last day of the current month. Use the supplied consts to indicate the desired dayOfWeek, ex. static::MONDAY.
integer | $dayOfWeek | The day of the week to move to. |
nthOfMonth(integer $nth, integer $dayOfWeek) : mixed
Modify to the given occurrence of a given day of the week in the current month. If the calculated occurrence is outside the scope of the current month, then return false and no modifications are made.
Use the supplied consts to indicate the desired dayOfWeek, ex. static::MONDAY.
integer | $nth | The offset to use. |
integer | $dayOfWeek | The day of the week to move to. |
firstOfQuarter(integer $dayOfWeek = null) : mixed
Modify to the first occurrence of a given day of the week in the current quarter. If no dayOfWeek is provided, modify to the first day of the current quarter. Use the supplied consts to indicate the desired dayOfWeek, ex. static::MONDAY.
integer | $dayOfWeek | The day of the week to move to. |
lastOfQuarter(integer $dayOfWeek = null) : mixed
Modify to the last occurrence of a given day of the week in the current quarter. If no dayOfWeek is provided, modify to the last day of the current quarter. Use the supplied consts to indicate the desired dayOfWeek, ex. static::MONDAY.
integer | $dayOfWeek | The day of the week to move to. |
nthOfQuarter(integer $nth, integer $dayOfWeek) : mixed
Modify to the given occurrence of a given day of the week in the current quarter. If the calculated occurrence is outside the scope of the current quarter, then return false and no modifications are made.
Use the supplied consts to indicate the desired dayOfWeek, ex. static::MONDAY.
integer | $nth | The offset to use. |
integer | $dayOfWeek | The day of the week to move to. |
firstOfYear(integer $dayOfWeek = null) : mixed
Modify to the first occurrence of a given day of the week in the current year. If no dayOfWeek is provided, modify to the first day of the current year. Use the supplied consts to indicate the desired dayOfWeek, ex. static::MONDAY.
integer | $dayOfWeek | The day of the week to move to. |
lastOfYear(integer $dayOfWeek = null) : mixed
Modify to the last occurrence of a given day of the week in the current year. If no dayOfWeek is provided, modify to the last day of the current year. Use the supplied consts to indicate the desired dayOfWeek, ex. static::MONDAY.
integer | $dayOfWeek | The day of the week to move to. |
nthOfYear(integer $nth, integer $dayOfWeek) : mixed
Modify to the given occurrence of a given day of the week in the current year. If the calculated occurrence is outside the scope of the current year, then return false and no modifications are made.
Use the supplied consts to indicate the desired dayOfWeek, ex. static::MONDAY.
integer | $nth | The offset to use. |
integer | $dayOfWeek | The day of the week to move to. |
average(\Cake\Chronos\ChronosInterface $dt = null) : static
Modify the current instance to the average of a given instance (default now) and the current instance.
\Cake\Chronos\ChronosInterface | $dt | The instance to compare with. |
isBirthday(\Cake\Chronos\ChronosInterface $dt) : boolean
Check if its the birthday. Compares the date/month values of the two dates.
\Cake\Chronos\ChronosInterface | $dt | The instance to compare with. |