Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

gauravgg
New Contributor III

subtract timestamp with current timestamp?

Hi

I have a date field as below

Date

01/12/2016 01:20:00 PM

03/12/2016 03:30:00 PM

06/12/2016 05:20:00 PM

I want to subtract the above Date field with the current date time and the output should be in hh:mm:ss

(i want to find the difference between dates    ---(Date - current timestamp))

can anyone help me

Thanks in Advance

Tags (1)
4 Replies
sushil353
Honored Contributor II

Re: subtract timestamp with current timestamp?

Try this:

=Date(Today()-Date#(Date,'DD/DD/YYYY hh:mm:ss TT'),'hh:mm:ss')

MVP
MVP

Re: subtract timestamp with current timestamp?

If DateField is a string:

=Interval(Today()-Date#(DateField,'DD/MM/YYYY hh:mm:ss TT'),'hh:mm:ss')

If you do the date interpretation during the initial load, then its simpler:

=Interval(Today() - DateField, 'hh:mm:ss')

gauravgg
New Contributor III

Re: subtract timestamp with current timestamp?

its not working

MVP
MVP

Re: subtract timestamp with current timestamp?

Interval(Today()-Date#(DateField,'DD/MM/YYYY hh:mm:ss TT'),'hh:mm:ss')

Above expression (already suggested by Jonathan) should work. Could you post a qvw that shows how it is not working?