Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
narender123
Specialist
Specialist

Calculate time difference

Hi all ,

I have to calculate the time differnce between two dates . Likes:

Column1                                   Column2

09-09-2014 13:28:46                   41891.576825799

Calculate time formate like hh:mm:ss

Both columns are date column .Column2 is in Num format of date.

Please suggest.

Thanks,

Narender

1 Solution

Accepted Solutions
Anonymous
Not applicable

may be like this?

Use TimeStamp() at script, like?

TimeStamp#(Coulmn2, 'DD-MM-YYYY hh:mm:ss')  as Column2DateTime

Now to find out the difference between two date column, try like this?

Interval(Column1 - Column2DateTime, 'hh:mm:ss') as Diff

View solution in original post

20 Replies
PrashantSangle

H,

Use interval()

For Example:

Interval(time2-time1,hh:mm)

For details see it in help menu.

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
jagan
Luminary Alumni
Luminary Alumni

Hi,

Try Interval()

Regards,

Jagan.

settu_periasamy
Master III
Master III

Hi,

Try this..

=Interval(41891.576825799-TimeStamp#('09-09-2014 13:28:46','DD-MM-YYYY hh:mm:ss'),'hh:mm:ss')

Anonymous
Not applicable

may be like this?

Use TimeStamp() at script, like?

TimeStamp#(Coulmn2, 'DD-MM-YYYY hh:mm:ss')  as Column2DateTime

Now to find out the difference between two date column, try like this?

Interval(Column1 - Column2DateTime, 'hh:mm:ss') as Diff

tamilarasu
Champion
Champion

You can also try,

Interval(Column1 - Num(Date#(Column2, 'DD-MM-YYYY hh:mm:ss')),'hh:mm:ss')

Anonymous
Not applicable

interval(column2 - column1,'DD-MM-YYYY hh:mm:ss') as differencetime

narender123
Specialist
Specialist
Author

Hi All,

Thanks you all.

I got the difference.

for total i have selected sum of rows in expression tab .So now it is showing total also.

But i want the Avg of all the time difference rather than toatl of "hh:mm:ss" means "sum of interval differnce/total number of entries".

Correct me if i am wrong.

Narender

narender123
Specialist
Specialist
Author

Thank you.

Please see my reply to Jagan Mohan ,i have one more question.

Narender

narender123
Specialist
Specialist
Author

Thank you.

Please see my reply to Jagan Mohan ,i have one more question.

Narender