System Function getRelativeDate()

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

Name in Zenario 8



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.



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


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().


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


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


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