Skip to content

Miscellaneous

distanceOfTimeInWords()

distanceOfTimeInWords() — returns any

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

NameTypeRequiredDefaultDescription
fromTimedateyesDate to compare from..
toTimedateyes,Date to compare to.
includeSecondsbooleanyesfalseWhether or not to include the number of seconds in the returned string.
distanceOfTimeInWords(fromTime, toTime [, includeSeconds ]) <cfset aWhileAgo = Now() - 30>
<cfset rightNow = Now()>
<cfoutput>#distanceOfTimeInWords(aWhileAgo, rightNow)#</cfoutput>