Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
prees959
Creator II
Creator II

Number of Days between two Dates not working

Hi,

I have the following in my load statement :

Timestamp#(Shift_Start_Date & ' ' & Start_Time,'YYYY-MM-DD hh:mm:ss.fff')  -

     date(Request_Date_Time,'dd/MM/yyyy hh:mm')   as temp_days,

Both my source dates aren't the same and are being loaded from a CSV file so Im trying to force them into dates and then subtract 1 from the other.

Can anyone help?

Many thanks,

Phil

5 Replies
MK_QSL
MVP
MVP

What is the format of both date fields? Can you provide sample data for 4 to 5 lines?

Digvijay_Singh

Can you share your source date format? If you show these dates in list box, are they showing up right aligned?

prees959
Creator II
Creator II
Author

Hi,

Once both fields are converted, the are shown as :

Request Date : 2008-09-08 18:12:04

Start Date : 2008-10-01 16:00:00

Also, when displayed side by side in a text box, the Request Date is aligned to the right and the Start Date is aligned to the left.  I'm guessing the field formats are different???

nagaiank
Specialist III
Specialist III

You may try

Floor([Request Date]) - Floor([Start Date])

MK_QSL
MVP
MVP

You can use any one from below depending on your requirements.

=TimeStamp#([Start Date],'YYYY-MM-DD hh:mm:ss') - TimeStamp#([Request Date],'YYYY-MM-DD hh:mm:ss')

or

=Floor(TimeStamp#([Start Date],'YYYY-MM-DD hh:mm:ss')) - Floor(TimeStamp#([Request Date],'YYYY-MM-DD hh:mm:ss'))

or

=Floor(TimeStamp#([Start Date],'YYYY-MM-DD hh:mm:ss')) - Floor(TimeStamp#([Request Date],'YYYY-MM-DD hh:mm:ss')) + 1