Back

timeAgoInWords()

Name Type Required Default Description
fromTime date Yes Date to compare from.
includeSeconds boolean No false Whether or not to include the number of seconds in the returned string.
toTime date No [runtime expression] Date to compare to.
1. Example in a controller (outputs: "3 months")
aWhileAgo = DateAdd("d", -90, Now());
timeAgoInWords(aWhileAgo)

2. Including seconds (outputs: "less than 5 seconds")
timeAgoInWords(DateAdd("s", -3, Now()), includeSeconds=true)

3. Comparing two specific dates (Outputs: "5 months")
past = CreateDateTime(2024, 01, 01, 12, 0, 0);
future = CreateDateTime(2024, 06, 01, 12, 0, 0);
timeAgoInWords(fromTime=past, toTime=future)
Copied!