Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Calculate age from a specified time

Guest
Sep 21, 2010 Sep 21, 2010

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

TOPICS
Getting started
516
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 21, 2010 Sep 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#">

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Oct 06, 2010 Oct 06, 2010
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources