Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content
Announcements
See why Qlik was named a Leader in the 2025 Gartner® Magic Quadrant™ for Augmented Data Quality Solutions: GET THE REPORT
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
Anonymous
Not applicable
Author

tried something like this

but not sure about the result .i got year as 1900

Timestamp(

Timestamp#( '10/02/2016 10:45:10')

-

Timestamp(Timestamp#(Now(),'D/M/YYYY hh:mm:ss'),'DD/MM/YYYY hh:mm:ss ')

,'DD/MM/YYYY hh:mm:ss ')

settu_periasamy
Master III
Master III

When you find the difference between your date, it should give the result as number. Not in Timestamp format.

Capture.JPG

LOAD RecievedDate,

  Now()-RecievedDate as Diff

From YourSource;

Capture1.JPG

achiever_ajay
Contributor III
Contributor III

Hi RGV,

Your expression should be changed slightly as below.

=Timestamp(

Timestamp(Now(),'DD/MM/YYYY hh:mm:ss')

-

Timestamp(Timestamp#('10/02/2016 10:45:10','DD/MM/YYYY hh:mm:ss'))

,'DD/MM/YY hh:mm:ss ')

Which Gives you result as 24/02/00 08:04:31  :::

Which to be interpreted as

24 days

2 Months

00 Years

8 Hrs

4 Min

31 sec

as the difference between DATE defined & NOW();

Hope it helpful.

Regards,

Ajay Kumar

+65-9390 2241

rgv rand wrote:

tried something like this

but not sure about the result .i got year as 1900

Timestamp(

Timestamp#( '10/02/2016 10:45:10')

-

Timestamp(Timestamp#(Now(),'D/M/YYYY hh:mm:ss'),'DD/MM/YYYY hh:mm:ss ')

,'DD/MM/YYYY hh:mm:ss ')

Anonymous
Not applicable
Author

Hi AjayKumar,

Thanks for the changes in the expression .