# QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join us for a live Q&A! September 21, 10 AM ET - Onboarding Fast in Qlik Sense SaaS! REGISTER
cancel
Showing results for
Did you mean:
Creator III

## Intervall

Hello best community ever

I need to get the intervall between the two dates. The result would be in days/hours/minutes and seconds

What I am doing now :

Interval(date(DATE_DERNIERE_MODIF,'DD/MM/YYYY hh:mm:ss') -date(DATE_CREATION, 'DD/MM/YYYY hh:mm:ss'),'DD : hh : mm : ss')

but the result in days

I think the result in incorrect? isn't?

second question, I have 3900 second, I have to convert it in hours, any idea?

Thanks

1 Solution

Accepted Solutions
MVP

Marcus -

If this timestamps are already read as dual, do we need to use TimeStamp function before we use it with the interval? or did you wante to use TimeStamp#() function?

Interval(

TimeStamp#(DATE_DERNIERE_MODIF,'DD/MM/YYYY hh:mm:ss TT')

-    TimeStamp#(DATE_CREATION, 'DD/MM/YYYY hh:mm:ss TT'),

'DD : hh : mm : ss')

9 Replies
Master

Seconds is pretty easy... 3900/60/60

the interval should work like that AFAIK

Please remember to mark this as helpful or the correct answer if I have helped you or answered your question.

MVP & Luminary

The result isn't correct because the 12-hour division of AM respectively PM aren't considered. Therefore try:

Interval(

timestamp(DATE_DERNIERE_MODIF,'DD/MM/YYYY hh:mm:ss TT')

-    timetsamp(DATE_CREATION, 'DD/MM/YYYY hh:mm:ss TT'),

'DD : hh : mm : ss')

Maybe it worked without the timestamp like:

Interval(DATE_DERNIERE_MODIF - DATE_CREATION, 'DD : hh : mm : ss')

Your seconds could be converted into hours with:

round(3900 / (60 * 60), 0.01) = 1.08

- Marcus

Master

Ah damn didn't spot the AM/PM issue

MVP

Marcus -

If this timestamps are already read as dual, do we need to use TimeStamp function before we use it with the interval? or did you wante to use TimeStamp#() function?

Interval(

TimeStamp#(DATE_DERNIERE_MODIF,'DD/MM/YYYY hh:mm:ss TT')

-    TimeStamp#(DATE_CREATION, 'DD/MM/YYYY hh:mm:ss TT'),

'DD : hh : mm : ss')

MVP & Luminary

Hi Sunny,

yes, you are right. If the values are dual the subtraction should work without any formatting and otherwise they should fail because strings couldn't be subtracted and would need a converting per timestamp#(). But it seems that it is different in this case if I look on the posted formula ...

- Marcus

Creator III
Author

Fot the interval, the issue is resolved. but to convert seconds into hours, there are some wrong result especially if the seconds<3600, look :

the formula I am using is : =time(Time#(DUREE_AVANT_CHANGEMENT,'s'))

MVP

May be this:

=Interval(Time#(DUREE_AVANT_CHANGEMENT,'s'), 'h:mm:ss')

Master

Your formula is giving you the number of seconds from midnight

What do you want it to show?

Creator III
Author

Thanks a lot Sunny. Now I get the right results.

Community Browser