Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

milliseconds

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

1 Solution

Accepted Solutions
MarcoWedel

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

View solution in original post

4 Replies
swuehl
MVP
MVP

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]

Anonymous
Not applicable
Author

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

MarcoWedel

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

MarcoWedel

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