2 Replies Latest reply: Jul 22, 2011 8:13 AM by lawrencem RSS

    Difference between 2 dates

      Hi

       

      I have 2 date fields in the format

       

      question_date eg : jun-25-2011

      answer_date eg:    jul-01-2011

       

       

      i need to find the difference between 2dates , in above case 6 days ...how do i write this in an expression.

        • Difference between 2 dates

          Hi,

           

          I have solve this problem in the script with the expression:

           

          answer_date - question_date AS difference

           

          Maybe you have to try

          num(answer_date) - num(question_date) AS difference

          if you converted the date field into the format 'jun-25-2011'.

           

          Regards

          Vicky

          • Re: Difference between 2 dates

            Hi,

                  PFA. I have used mapping function to map Month names to numeric values i.e Jan is 1, Dec is 12 . Then created the dates in M/D/YYYY format using makedate() function. You may then apply logic for subtracting the two dates as needed. Hope this helps.

             

            Thanks.