Date/Time Calculation

This topic is 5763 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hey,

I'm trying to format a date calculation and I'm a bit stuck. I'm trying to track the number of days, hours, minutes it took for a project to be completed. I used ProjectFinishedTimeStamp - ProjectStartedTimeStamp. The calculation Result is TIME.

How do convert the result of 6557:17:39 into 'D' days 'H' Hours : 'M' Minutes?

Much appreciated,

P

Share on other sites

Have you looked at the custom Functions on Brian Dunnings site?

http://www.briandunning.com/filemaker-custom-functions/list.php

You may find what you need there.

Share on other sites

Here's one possible way:

Let ( [

diff = GetAsTimestamp ( ProjectFinishedTimeStamp - ProjectStartedTimeStamp ) ;

days = Day ( diff ) - 1 ;

hours = Hour ( diff ) ;

minutes =Minute ( diff )

] ;

days & ":" & hours & ":" & minutes

)

The result must be Text.

---

EDIT:

Oops, I have accidentally omitted an important part of my post.

The above formula is a convenient shortcut, but it is limited to periods of less than 31 days. If the elapsed period may exceed this limit, it's necessary to move to a slightly more cumbersome (but always correct) version:

Let ( [

diff = ProjectFinishedTimeStamp - ProjectStartedTimeStamp ;

days = Div ( diff ; 86400 ) ;

hours = Div ( Mod ( diff ; 86400 ) ; 3600 ) ;

minutes = Div (Mod ( diff ; 3600 ) ; 60 )

] ;

days & ":" & hours & ":" & minutes

)

Edited by Guest
Share on other sites

Thank you Comment.

I was stuck on how to break down the seperate numbers from days:hours:minutes. The Div and Mod works great. Thanks a bunch.

Share on other sites

This topic is 5763 days old. Please don't post here. Open a new topic instead.

Create an account

Register a new account