Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Date subtraction

Hi,

I have date field called 'receivedate' in my table with time stamp like 10/02/2016 12:10:45 am..........

i want to subtract from present date&time to my datefiled. i tried by using now function.

now()-receivedate but it is not giving correct output.

13 Replies
sunny_talwar

What result did you get? Can you share your output and what you expected?

sunny_talwar

I am getting 56 05:02:10 based on EST... using this:

=Interval(Now() - TimeStamp#('10/02/2016 12:10:45 AM', 'DD/MM/YYYY hh:mm:ss TT'), 'D hh:mm:ss')

Not applicable
Author

Hi Please find the attached excel

Here i have date field and my output is there.

Not applicable
Author

I need to get date along time stamp

sunny_talwar

Is this your output (within the blue circle)

Capture.PNG

How do you interpret this? Year 1900?

Not applicable
Author

yes that is my output

PradeepReddy
Specialist II
Specialist II

small modification to sunny solution..

=TimeStamp(Interval(Now()- TimeStamp#('9/28/2015 12:36:54 PM', 'MM/DD/YYYY hh:mm:ss TT'), 'D hh:mm:ss'))

Not applicable
Author

09-07-1990 02:24:23 i am getting like this.

i think this is not correct

sunny_talwar

I would recommend just using TimeStamp or Date (and get rid of Interval

=Timestamp(Now() - TimeStamp#('10/02/2016 12:10:45 AM', 'DD/MM/YYYY hh:mm:ss TT'))

or

=Date(Now() - TimeStamp#('10/02/2016 12:10:45 AM', 'DD/MM/YYYY hh:mm:ss TT'))

Can be done in script, like this:

Timestamp(Now() - TimeStamp#(FieldName, 'DD/MM/YYYY hh:mm:ss TT')) as TimeStampDiff,

Date(Now() - TimeStamp#(FieldName, 'DD/MM/YYYY hh:mm:ss TT')) as DateDiff,