Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Difference between two dates

Hi!,

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.

11 Replies
Not applicable
Author

Did you try using Timestamp(Num(Date)-(2/24),'YYYY-MM-DD hh:mm:ss')  ?

fernando_tonial
Partner - Specialist
Partner - Specialist

You can change the initial settings in the script.

SET TimestampFormat='M/D/YYYY h:mm:ss[.fff] TT';

for

SET TimestampFormat='DD/MM/YYYY hh:mm:ss[.fff]';

Don't Worry, be Qlik.