Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear all,
is there a function in Qlikview to calculate milliseconds, like the function below:
sum(DATEDIFF (MILLISECOND , isnull(START_DATE,0) , isnull(END_DATE,0))) TIMEDURATION
Help please !!
Thanks in advance
multiplying an interval with 86400 (number of seconds per day) should suffice to get the intervall in seconds.
So your expression
ceil(num#(text(Interval(TIMEDIFF, 'hh')))*3600 + minute(TIMEDIFF)*60 + second(TIMEDIFF)) as SECONDS
simply becomes
TIMEDIFF * 86400 as SECONDS
To get the milliseconds, it would be just
TIMEDIFF * 86400000 as SECONDS
regards
Marco
Sorry, I don't get what you want.
Time calculations are just floating point operations, like
Time1 - Time2 as TimeDiff
in a load script to get the difference of field values (assuming Time1 and Time2 are correctly interpreted as time values).
You can format the Result using
Interval(TimeDiff,'hh:mm:ss.fff')
[where fff denotes the milliseconds]
First of all, thanks for your replay.
I need to calculate the milliseconds.
I do this:
ceil(num#(text(Interval(TIMEDIFF, 'hh')))*3600 + minute(TIMEDIFF)*60 + second(TIMEDIFF)) as SECONDS
but I don't know how to calculate milliseconds
I hope I explained a bit better
multiplying an interval with 86400 (number of seconds per day) should suffice to get the intervall in seconds.
So your expression
ceil(num#(text(Interval(TIMEDIFF, 'hh')))*3600 + minute(TIMEDIFF)*60 + second(TIMEDIFF)) as SECONDS
simply becomes
TIMEDIFF * 86400 as SECONDS
To get the milliseconds, it would be just
TIMEDIFF * 86400000 as SECONDS
regards
Marco
like swuehl already said:
always remember that timestamps and intervals are just floating point numbers with the integer part being full days and the fraction being the hours, minutes and seconds.
regards
Marco