Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
CodingApprentice01
Contributor
Contributor

Date and Time

The data in my data set is as follows:

Initiated Date Time - 17/02/2024 09:20:49

Connected Date Time - 17/02/2024 09:20:58

However in my Qlik it is only displaying the date "17/02/2024" and not the time. I want to look at the difference in initiated and connected call times but cant get the correct data to do so. Any tips on firstly how to get the time to show, and then how to express the difference in this time?

Labels (4)
2 Replies
Sayed_Mannan
Creator II
Creator II

To display both date and time in Qlik Sense and calculate the difference between the Initiated Date Time and Connected Date Time, follow these steps:

1. Ensure Correct Timestamp Format: In your data load script, set the timestamp format to include both date and time:

SET TimestampFormat='DD/MM/YYYY hh:mm:ss';

2. Load Data with Correct Format: When loading your data, ensure the date-time fields are interpreted correctly:

LOAD
Timestamp([Initiated Date Time], 'DD/MM/YYYY hh:mm:ss') AS InitiatedDateTime,
Timestamp([Connected Date Time], 'DD/MM/YYYY hh:mm:ss') AS ConnectedDateTime
FROM [yourdata];

4. Calculate Time Difference: To calculate the difference between the two timestamps, use the Interval function:

Interval([ConnectedDateTime] - [InitiatedDateTime], 'hh:mm:ss') AS CallDuration

here’s an example of how your script might look:

SET TimestampFormat='DD/MM/YYYY hh:mm:ss';

LOAD
Timestamp([Initiated Date Time], 'DD/MM/YYYY hh:mm:ss') AS InitiatedDateTime,
Timestamp([Connected Date Time], 'DD/MM/YYYY hh:mm:ss') AS ConnectedDateTime,
Interval(Timestamp([Connected Date Time], 'DD/MM/YYYY hh:mm:ss') - Timestamp([Initiated Date Time], 'DD/MM/YYYY hh:mm:ss'), 'hh:mm:ss') AS CallDuration
FROM [YourDataSource];

I hope this helps.

Padma123
Creator
Creator

timestamp is not correct format use timestamp#() and timestamp() for correct format of the data,

date from timestamp use expression like

Date(Floor(fieldname)) as date,

time (Frac(fieldname)) as time. 

time difference between Connected Date Time  and Initiated Date Time

interval([Connected Date Time]-[Initiated Date Time])