Return to v2.1 docs


Global Helpers Date Functions string controller model migrator migration tabledefinition

Pass in two dates to this method, and it will return a string describing the difference between them.

Name Type Required Default Description
fromTime date Yes Date to compare from.
toTime date Yes Date to compare to.
includeSeconds boolean No false Whether or not to include the number of seconds in the returned string.
// Controller code.
rightNow = Now();
aWhileAgo = DateAdd("d", -30, rightNow);

// View code.
<!--- Will output: about 1 month --->
#distanceOfTimeInWords(aWhileAgo, rightNow)#

Related Functions

Date Functions