Fr3nch13/CakePHP Utilities

DifferenceFormatter
in package
implements DifferenceFormatterInterface

Handles formatting differences in text.

Provides a swappable component for other libraries to leverage. when localizing or customizing the difference output.

Table of Contents

Interfaces

DifferenceFormatterInterface
Interface for formatting differences in text.

Properties

$translate  : Translator
The text translator object

Methods

__construct()  : mixed
Constructor.
diffForHumans()  : string
Get the difference in a human readable format.

Properties

Methods

diffForHumans()

Get the difference in a human readable format.

public diffForHumans(ChronosInterface $date[, ChronosInterface|null $other = null ][, bool $absolute = false ]) : string
Parameters
$date : ChronosInterface

The datetime to start with.

$other : ChronosInterface|null = null

The datetime to compare against.

$absolute : bool = false

removes time difference modifiers ago, after, etc

Tags
see
ChronosInterface::diffForHumans
Return values
string

The difference between the two days in a human readable format


        
On this page

Search results