$diffFormatter
$diffFormatter : \Cake\Chronos\DifferenceFormatter
Instance of the diff formatting object.
Provides methods for getting differences between datetime objects.
Expects that the implementing class implements:
$diffFormatter : \Cake\Chronos\DifferenceFormatter
Instance of the diff formatting object.
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 |
fromNow(\DateTime|\DateTimeImmutable $datetime) : \DateInterval|boolean
Convenience method for getting the remaining time from a given time.
\DateTime|\DateTimeImmutable | $datetime | The date to get the remaining time from. |
The DateInterval object representing the difference between the two dates or FALSE on failure.
diffForHumans(\Cake\Chronos\ChronosInterface|null $other = null, boolean $absolute = false) : string
Get the difference in a human readable format.
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 |
diffFormatter(\Cake\Chronos\DifferenceFormatter|null $formatter = null) : \Cake\Chronos\DifferenceFormatter
Get the difference formatter instance or overwrite the current one.
\Cake\Chronos\DifferenceFormatter|null | $formatter | The formatter instance when setting. |
The formatter instance.