System Function getRelativeDate()

function getRelativeDate(
$timestamp, $maxPeriod = "day", $addFullTime = false, $format_type = false, $languageId = false
)

Name in Zenario 8

ze\date::relative()

Description

Formats a recent date or time into a friendly relative format, e.g. "35 seconds ago" or "6 days ago".

Where You Can Use It

From Zenario 7.3 onwards.

Parameters

$timestamp

A MySQL timestamp, a unix timestamp, or a PHP date object.

$maxPeriod

The highest length of time that we should go up to, 'sec', 'min', 'hour', 'day', 'month' or 'year'.

If the relative time is equal or higher, then instead of returning a relative date this function will just return a date using formatDateNicely().

$addFullTime

Add the full date and time in brackets after the relative date using formatDateTimeNicely().

$format_type

The date format to use for formatDateNicely() and formatDateTimeNicely().

$languageId

The language to use. Defaults to the current visitor's language.