on 07-20-2009 7:20 PM
I need a formula that will give me the time elapsed in hours and minutes. The hours may be over a two-day period -- starting sometime before midnight on one date; and ending sometime on the next date. Hope you can help. Thanks in advance. I love you guys.
Kathryn.
Hello Kathryn,
Try this formula;
numbervar b:= datediff( 's', , );
numbervar i;
numbervar n;
i:= truncate( b/3600);
n:= if b <> i3600 then remainder( b, (i3600))/ 60 else 0'
totext(i,0) + ':' + totext(n,0)
Variable i will calculate the hours while n will output the minutes. The datediff is done in seconds so that it will round up to the nearest minute.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Update:
I had a typo in the 4th line, and have now progressed to the 5th line -- where I have a new error.
On the 5th line: the letter "i" is highlighted and the error says "The keyword then is missing".
I tried adding the "then", but that results in a message saying that the remaining text does not appear to be part of the formula.
Sorry about my typo on line 4. Do you have any ideas on how I can get past line 5?
Sanjay is trying to tell you to do the following to make the original post by Graham work for you.
numbervar b:= datediff( 's', {startdatefield}, {enddatefield});
numbervar i;
numbervar n;
i:= truncate( b/3600);
n:= if b <> i*3600 then remainder( b, (i*3600))/ 60 else 0;
totext(i,0) + ':' + totext(n,0)
I hope this helps,
Regards,
Zack H.
User | Count |
---|---|
87 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.