0

leap years

Hello, 

I have to compute the number of days between two dates. I'am using the following code : days('DÉBUT - FACT. - FRAIS', 'FIN - FACT. - FRAIS'). But these code does not compute the 29th of February. 

Any ideas ?

Thanks in advance. 

1 reply

null
    • John_Halls
    • 3 yrs ago
    • Reported - view

    Hi Raphael

     

    This is a red herring, nothing to do with 29th February. The days() function takes the difference between two date, not the number of days. days(date(2020,02,01),date(2020,02,29)) gives 28 just as days(date(2020,01,01),date(2020,01,31)) gives 30. You need to add 1 to the formula to give you the number of days, eg days(date(2020,01,01),date(2020,01,31)) + 1 gives 31.

     

    Your code needs to be days('DÉBUT - FACT. - FRAIS', 'FIN - FACT. - FRAIS') + 1

     

    Regards John

Content aside

  • 3 yrs agoLast active
  • 1Replies
  • 169Views