Discussion Board for collaboration on QlikView Scripting.
I have two dates and i want to calculate the difference between the two in hours. Not sure which function i have to use or how to go about it . Can somebody throw some light on this.
Also in other requirement i want to subtract 2 hrs from my time stamp.
The format in which in which i am getting date and time from SQL is '2012-02-22 13:20:00.000'
Thanks in advance.
You can try this.
Interval( End - Start, 'hh:mm:ss' ).
Interval(End - Start - (2/24), 'hh:mm:ss')
in order to get 2 hours less
for 2 hr less i dont want the difference in hrs. i just want to subtract my timestamp by 2 hrs and then compare it with other time stamp. so i just need to subtract 2 hrs and want the result in same format.
Try with interval function.
=interval(EndDate-StartDate,'hh') which will give you hrs difference.
For subtracting 2 hrs use expr below
=Timestamp(Num(Date)-(2/24)) which will give you subtraction of 2 hrs.
Hope it helps
QV uses numbers to represent timestamps, so is the same to substract 2 hours to the total or to the last timestamp.
interval( (End-Num('02:00'))-Start, 'hh:mm:ss' )
Time(interval( End-Start, 'hh:mm:ss' )-Num('02:00'))
Time(interval( End-Start, 'hh:mm:ss' )-(2/24))
Hi! i am getting my date and time in 12 hr format i.e 23/02/2012 5:44:03 PM i want it in 24 hr format like
If you're using the time function you can add formatting
using previous example
Time(interval( End-Start, 'hh:mm:ss' )-(2/24),'hh:mm:ss') should give you 24hours format.
by Using "Timestamp(Num(Date)-(2/24))" using date as "2012-02-22 15:19:00.000"
i am getting two hr difference but i am getting the result in AM/PM format like 22/02/2012 1:19:00 PM i want the result as 22/02/2012 13:19:00