Helper class for formatting relative dates & times.
_diffData(mixed $futureTime, mixed $pastTime, bool $backwards, mixed $options)
Calculate the data needed to format a relative difference string.
int|string
$futureTime The timestamp from the future.
int|string
$pastTime The timestamp from the past.
bool
$backwards Whether or not the difference was backwards.
array
$options An array of options.
array
An array of values.
_options(array $options, string $class)
Build the options for relative date formatting.
array
$options The options provided by the user.
string
$class The class name to use for defaults.
array
Options with defaults applied.
dateAgoInWords(\Cake\I18n\I18nDateTimeInterface $date, array $options)
Format a into a relative date string.
\Cake\I18n\I18nDateTimeInterface
$date The date to format.
array
$options optional Array of options.
string
Relative date string.
diffForHumans(\Cake\Chronos\ChronosInterface $date, ?\Cake\Chronos\ChronosInterface $other, bool $absolute)
Get the difference in a human readable format.
\Cake\Chronos\ChronosInterface
$date The datetime to start with.
\Cake\Chronos\ChronosInterface|null
$other optional The datetime to compare against.
bool
$absolute optional Removes time difference modifiers ago, after, etc.
string
The difference between the two days in a human readable format.
timeAgoInWords(\Cake\I18n\I18nDateTimeInterface $time, array $options)
Format a into a relative timestring.
\Cake\I18n\I18nDateTimeInterface
$time The time instance to format.
array
$options optional Array of options.
string
Relative time string.
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.1/class-Cake.I18n.RelativeTimeFormatter.html