How do I use DateDiff to determine the difference in seconds ?
Posted on 2003-03-23
I've got this script which will display the Difference in the times like so:
Days, Hours, Minutes
But I want it to display the difference like:
Days, Hours, Minutes, Seconds
Here is the script I am currently using:
<CFSET days = DateDiff("d",Now(),date2)>
<CFSET hours = DateDiff("h",Now(),date2) - (24 * days)>
<CFSET minutes = DateDiff("n",Now(),date2) - (24 * 60 * days) - (60 * hours)>
<CFOUTPUT>#days# days, #hours# hours, #minutes# minutes</CFOUTPUT>
This would display something like:
3 days, 2 hours, 34 minutes
I need it to also display the seconds, I just can't seem to work out the maths that's all :)
If any one knows the answer please let me know.
Thanks in advance.