2 Replies Latest reply on Dec 30, 2008 2:33 PM by comment_1

    Calculate Number of Weeks and days DueDate-CurrentDate



      Calculate Number of Weeks and days DueDate-CurrentDate




      I am having some trouble doing a simple calculation. 


      I want to calculate the number of weeks and days from the due date to the current date. If this is a negitive number that is fine.

      I'd like to keep the weeks seperated from the days because I want to sort and report on the weeks from due date.



      Due: 12/25/2008 Current Date: 12/30/2008 = 0 weeks -5 days

      Due: 12/16/2008 Current Date: 12/30/2008 = -2 weeks 0 days

      Due: 1/17/2009 Current Date: 12/30/2008 = 2 weeks -1 days


      I am calculating the weeks

      Int ( (ReleaseDate-Get ( CurrentDate ))/7 )

      And Days

      Mod ( ReleaseDate-Get ( CurrentDate ) ; (Sign ( ReleaseDate-Get ( CurrentDate ) ))*7 )


      Is there a betterway to do this? (actualy this is the way I came up with while typing the question and is working pretty well.)


      Also I changed the date (4 days ahaed) on my system to run a report (reset date) and it seemed to mess up (all 4 days behind) my date calculations. So much so that I had to re-import all the records again to make the date math correct.


      Is there anyplace to reset this?


      Thank you,