Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
danielnevitt
Creator
Creator

Difference between date fields

Hi,

I would appreciate some help to show me the difference between two date fields in minutes.

The date fields are in the format dd/mm/yyyy hh:mm:ss

Example:

01/01/2016 13:00:00

01/02/2016 13:00:00

Using the above example I would like to show the result 1440 minutes.

Thanks,

Daniel

1 Solution

Accepted Solutions
marcus_sommer

Try it with: interval(Date2 - Date1, 'mm')

- Marcus

View solution in original post

3 Replies
marcus_sommer

Try it with: interval(Date2 - Date1, 'mm')

- Marcus

maxgro
MVP
MVP

(date2 - date1) * 24 * 60

44640 minutes with DD/MM/YYYY format (about 1 month)

but I think you mean MM/DD/YYYY format, so the result is 1440 minutes (1 day = 1 * 24 * 60)

ramchalla
Creator
Creator

Hi Daniel,

You can use the below code in script.

T1:

LOAD * INLINE [

    Date1,Date2

    01/01/2016 13:00:00,01/02/2016 13:00:00

   ];

T2:

load Date(timestamp#(Date2,'MM/DD/YYYY hh:mm:ss'),'DD/MM/YYYY') as Dt2,

  Date(timestamp#(Date1,'MM/DD/YYYY hh:mm:ss'),'DD/MM/YYYY') as Dt1,

  Interval( (Date(timestamp#(Date2,'MM/DD/YYYY hh:mm:ss'),'DD/MM/YYYY')) -   (Date(timestamp#(Date1,'MM/DD/YYYY hh:mm:ss'),'DD/MM/YYYY')), 'mm') as DTDiff

Resident T1;