Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
isciberras
Creator
Creator

Calculating time difference between date and time stamps

Hi,

I am having an issue with a combined  date and time stamp.

Basically all I want to do is calculate (In hours) the time difference between a start day&time stamp and the end of the day&time stamp. 

All start and end times are differentiated by a reference number. 

I researched in the Qlik community and tried different solutions however, even when QlikView returns a result it will still return a number which is not the correct amount of hours between a start and an end time. 

 

I attached an example of what I am trying to achieve 

Labels (3)
2 Replies
rubenmarin

Hi, Timestamp#() is used to tell the format of the timestamp that is being readed, so in this case it should be 'DD/MM/YYYY hh:mm' (note that time letters are lowercase: MM for months, mm for minutes), so the final table shoud be:

Main:
load
*,
  interval(Timestamp#([End Date],'DD/MM/YYYY hh:mm') - Timestamp#([Start Date],'DD/MM/YYYY hh:mm'),'hh:mm') as [Time difference]
  
  Resident
Staging;

 

Brett_Bleess
Former Employee
Former Employee

Did Ruben's post get you what you needed?  If so, do not forget to return to your thread and on his post, use the Accept as Solution button to mark his post as the solution and given him credit for the help as well as let other Members know it worked.  If you are still working on things, leave us an update on what you still need.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.