Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Difference between two timestamp

Hi,

I am facing a problem in QV11 to figure out the difference between two timestamps, for e.g. (column1) 04-08-2012 05:12:11 AM - (column2) 04-08-2012 05:11:11 PM.

Kindly help me out. Thank you in advance.

Regards

Ram

13 Replies
Not applicable
Author

'DD-MM-YYYY hh:mm:ss tt'

sreenivas
Creator III
Creator III

=Date(Date#('Fieldname1','DD-MM-YYYY hh:mm:ss tt'),'DD-MM-YYYY hh:mm:ss tt')-

Date(Date#('Fieldname2','DD-MM-YYYY hh:mm:ss tt'),'DD-MM-YYYY hh:mm:ss tt')

swuehl
MVP
MVP

Would be helpful if you could tell us what you get and what you expect when using which expression / script snippet.

I am mostly repeating my above post (just adding your two sample values to two sample fields), but this still seems to return a reasonable result:

SET TimestampFormat='DD-MM-YYYY hh:mm:ss TT';

LOAD

column1,

column2,

interval(column1-column2) as TimeStampDiff

INLINE [

column1, column2

04-08-2012 05:12:11 AM,04-08-2012 05:11:11 PM

];

Not applicable
Author

Guys,

Im facing the same problem. Is it possible to remove the AM and take 16:00:00 instead on 4:00:00 PM

Thanks.

Mpho