Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

interval between dates

Hello to all.
How can I calculate the differe between two dates in minutes. The date format is of the type DD / MM / YYYY hh: mm: ss?
I tried the instruction:


interval (# timestamp (departure, 'DD / MM / YYYY hh: mm: ss') - # timestamp (arrival, 'DD / MM / YYYY hh: mm: ss'), 'hh')


but does not work


Thank you all

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Time() is a formatting function, which you don't need if you format with interval():

interval ( departure -arrival, 'mm')


edit: Read more about Formatting vs. Interpretation functions:

The Date Function

View solution in original post

7 Replies
sunny_talwar

May be like this:

Interval(TimeStamp#(departure, 'DD / MM / YYYY hh: mm: ss') - TimeStamp#(arrival, 'DD / MM / YYYY hh: mm: ss'), 'mm')

Do you have these extra spaces between DD and MM? I mean do you have this

15 / 10 / 2016 10: 38: 00

or do you have this?

15/10/2016 10:38:00

If later, then try this:

Interval(TimeStamp#(departure, 'DD/MM/YYYY hh:mm:ss') - TimeStamp#(arrival, 'DD/MM/YYYY hh:mm:ss'), 'mm')

Not applicable
Author

hi Sunny.

Sorry.  But do not have extra spaces between spaces between DD and MM.


thank

sunny_talwar

So did my second suggestion worked? or are you still having issues?

Not applicable
Author


Yes. I tried your second suggestion, but it did not work.


Then I tried this statement:
interval (time (departure) - time (arrival), 'mm')
and it seems to work.


what do you think about it?

thank you

sunny_talwar

I think if you departure and time are already read as date, we don't need to use TimeStamp#() function. So, I think you are in good shape there

swuehl
MVP
MVP

Time() is a formatting function, which you don't need if you format with interval():

interval ( departure -arrival, 'mm')


edit: Read more about Formatting vs. Interpretation functions:

The Date Function

susovan
Partner - Specialist
Partner - Specialist

Hi Marino,

May be like this,

Interval(TimeStamp(departure, 'DD / MM / YYYY hh: mm: ss') - TimeStamp(arrival, 'DD / MM / YYYYhh: mm: ss'), 'mm')

Warm Regards,
Susovan