Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, I'm trying to find the difference of two timestamps using interval(a-b), only I don't fully understand the numbers involved. Could anyone help explain to me how timestamp works? Essentially I want to say,
vAge = interval(timestamp(now()) - B)
if vAge <= '8 hours' Then
do something
The touble I'm having is working out what '8 hours' should look like? I've not had much luck deciphering the number that a timestamp gets converted from / to, from what I gather 0.0007 = 1 minute? Any help would be much appreciated! Thanks.
The number that date arithmetic returns is in 'Days'. To convert days to hours, you divide multiply by 24.
To convert 8 hours into the number of days, for comparison purposes:
1 day / 24 hours = 0.0416 X 8 hours = 0.33 (repeating)
The same holds for minutes, seconds, years, etc. Just treat whole numbers as 'days', and convert.
So in your case, I would take the time that I want to compare (8 hours) and convert that using the formula, and then just compare that to your date calculation.
So, 8 hours seems to equate to 0.33334, but I only found that through trial and error and am still really non the wiser as to why I'm using this value. There must be a more straightforward way of checking the difference in hours between two times?
Hello Rich,
That value is equivalent to say that 8 hours are a third of a day. Interval() is used when the resulting time is more than 24 hours, and want to be showed as hours:mins:secs. So I'm guessing you are looking something like (untested)
=interval(time('12:30', 'hh:mm') - time('03:54', 'hh:mm'), 'hh:mm')
will return something like '08:36'.
Hope that helps
The number that date arithmetic returns is in 'Days'. To convert days to hours, you divide multiply by 24.
To convert 8 hours into the number of days, for comparison purposes:
1 day / 24 hours = 0.0416 X 8 hours = 0.33 (repeating)
The same holds for minutes, seconds, years, etc. Just treat whole numbers as 'days', and convert.
So in your case, I would take the time that I want to compare (8 hours) and convert that using the formula, and then just compare that to your date calculation.
Hi Ryan,
I have done this that how to calculate the difference between hours in two timestamps.
I m sending you the attachment. Please upload the test file and check it out. is this the what you required or not.
I have selected two date with timestamp and now, it will take starting hour and ending hour and calculate the difference between them.
I think this is something like that what you required.
Plz let me know its fruitful for u or not.
Thanks
Neetu Singh
Hi neetu,
Can you please send the logic ,because of personal edition ,I cant open your Qlikview app.
Thank's & Regards,
Sumit Jadhav.