3 Replies Latest reply: May 17, 2011 4:11 AM by nduraz00 RSS

    problem with number of days in february 2011

      Hi everybody,

       

      I use this expression, to calculate the difference of days between two dates :

       

      DayNumberOfYear([Date_de_fin])- DayNumberOfYear([Date_de_creation])

       

      It works well, expect for february. e.g. for QV there is 15 days between the 19th of february 2011 and the 5th of march.I and excel count 14 ...

       

      Am I using the wrong expression ? Thanks for your help.

       

      Nico

       

      PS : I'm using QV 10 and the date format I use is DD/MM/YYYY

        • problem with number of days in february 2011
          Erich Shiino

          Not sure why this is happening for you, but why don't you straight to the date difference:

           

          ([Date_de_fin])- ([Date_de_creation])

           

          Hope it helps,

           

          Erich

          • problem with number of days in february 2011
            Patrick Laredo

            hi,

             

            try Num()

             

            With two variables defined as follows:

             

            set vDay1='19/02/2011';

            set vDay2='05/03/2011';

             

            I got 15 using this

             

            =DayNumberOfYear('$(vDay2)')-DayNumberOfYear('$(vDay1)')

             

            and 14 using this

             

            =num('$(vDay2)')-num('$(vDay1)')

             

            probably linked to the first using/expecting a timestamp and the 2nd a number. But I don't know for sure. If your fields Date_de_Fin and Date_de_creation are timstamps use floor() to make them into numbers.

             

            Hope this helps

              • problem with number of days in february 2011

                Thanks to you two for your help.

                 

                I was not using ([Date_de_fin])- ([Date_de_creation]) because I have some empty fields. But in fact it's the best way, so I manage to avoide calculating the expression when the field is NULL and it works now.

                 

                DayNumberOfYear is using 366 days years, so that's why february has always 29 days, even when it should'nt ...

                 

                I have now to check if it works betwen two different year, but it should be ok.

                 

                Again, thank a lot for you answers.

                Enjoy

                Nico