Date Diff problem (1 Viewer)

Steve_T

Registered User.
Local time
Today, 01:26
Joined
Feb 6, 2008
Messages
96
Hello,
I am having problems creating a Exp to show the difference in time.
I am currently using :Expr1:DateDiff("n",[TimeReported],[TimeDefectGiven]) which is returning a figure in decimal.
If the answer was to be 90 minutes i need it to return the figure as 1.50 instead.

I have looked on the site using Date Diff and Time without success


Any help given would be great
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 17:26
Joined
Aug 30, 2003
Messages
36,127
Divide the minutes by 60.
 

mresann

Registered User.
Local time
Yesterday, 17:26
Joined
Jan 11, 2005
Messages
357
If you need the decimal, then the following will work (given that there is no nulls)

DateDiff("n",[TimeReported],[TimeDefectGiven]) / 60

This divides the minutes by 60, which gives you the hours in decimals, which is this case would be 1.5 .

If you need a clock-like display (such as 1:30), then the following works:

DateDiff("n",[TimeReported],[TimeDefectGiven])\60 & ":" & _
Format(DateDiff("n",[TimeReported],[TimeDefectGiven]) MOD 60, "00")
 

Steve_T

Registered User.
Local time
Today, 01:26
Joined
Feb 6, 2008
Messages
96
Thankyou to you both, its now returning the result as i need it.
 

Users who are viewing this thread

Top Bottom