DiffDays function issue?

DiffDays function issue?

  

Hi,

  I have been playing around with the DiffDays() function and have noticed that it throws some unexpected results. I will try to explain...

e.g. StartDate = 25/01/2017 and EndDate  = 24/01/2018 - 

      DiffDays(StartDate, EndDate) returns 364 which is correct.

However...
     StartDate = 25/01/2017 and EndDate = 24/06/2017 

     DiffDays(StartDate, EndDate) returns 149 which is incorrect, it should be 150. 

I created a simple loop to increment the end date by 1, and perform the function (using both DIffDays and DiffMinutes), so I could display the results in a list. An extract of this list is attached.

The 'error' appears to start on 26th March but corrects itself on the 29th October, so if the start and end days are outside of this period everything works ok.

I suspect it will be due to Time/Clock changes, but would have hoped the DiffDays would handle that.

Does anyone have any suggestions how this can be managed.


many thanks 


Hi Neil,

Can you tell the version of the platform, stack (.Net or JAVA) and whether its a server or client-action?

João Neves wrote:

Hi Neil,

Can you tell the version of the platform, stack (.Net or JAVA) and whether its a server or client-action?

Hi sorry for the delay in responding.

Out platform is on the Java Stack - Platform version 9.1.501.0. 

I used the DiffDays function in an Assign widget within a User Action.

Thanks

Neil


Hi Neil

That behavior of DiffDays and DiffMinutes is documented here and here. I would suggest you to use the
DiffHours built-in function and some additional logic in order to overcome the problems with Daylight Saving Time.


Hope this helps