pbang007 Posted November 29, 2008 Posted November 29, 2008 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
aldipalo Posted November 29, 2008 Posted November 29, 2008 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.
comment Posted November 29, 2008 Posted November 29, 2008 (edited) 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 November 29, 2008 by Guest
pbang007 Posted December 1, 2008 Author Posted December 1, 2008 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.
Recommended Posts
This topic is 5889 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now