Skip to main content
September 21, 2010
Question

Calculate age from a specified time

  • September 21, 2010
  • 2 replies
  • 552 views

I need to calculate the age based upon the time specified.

E.g.

Suppose time specified is:

3605000 millisecinds

It should return an age of : 1 Hour 5 seconds.

Was wondering if anyone can help me here.

Thanks,

SAM

This topic has been closed for replies.

2 replies

Cyril Hanquez
Participating Frequently
October 6, 2010

What about using the following millisecondsToDate UDF http://www.cflib.org/udf/millisecondsToDate ?

#millisecondsToDate(3605000)# -> {ts '1970-01-01 01:00:05'}

#TimeFormat(millisecondsToDate(3605000),"hh:mm:ss")# -> 01:00:05

Cyril

Owainnorth
Inspiring
September 21, 2010

I *think* this'll do you, but I'd suggest you check as I'm more concentrating on my mexican chicken sandwich at the moment:

<cfscript>
    Time = 8605000 ;
    TimeData = {} ;   
    TimeData.Hours = int(Time / 3600000) ;
    TimeData.Minutes = int(Time / 60000) MOD 60 ;
    TimeData.Seconds = int(Time / 1000) MOD 10 ;
</cfscript>

<cfdump var="#TimeData#">