asRelativeTime() public method
Formats the value as the time interval between a date and now in human readable form.
This method can be used in three different ways:
- Using a timestamp that is relative to
now. - Using a timestamp that is relative to the
$referenceTime. - Using a
DateIntervalobject.
| public string asRelativeTime ( $value, $referenceTime = null ) | ||
|---|---|---|
| $value | integer|string|DateTime|DateInterval |
The value to be formatted. The following types of value are supported:
|
| $referenceTime | integer|string|DateTime |
If specified the value is used as a reference time instead of |
| return | string |
The formatted result. |
| throws | yii\base\InvalidParamException |
if the input value can not be evaluated as a date value. |
Please login to continue.