Calculations with date field

Viewing 3 reply threads
  • Author
    Posts
  • May 17, 2015 at 10:42 AM #13743

    Kuma Kato
    Participant

    Hi. I would like to keep track of which week my project is in by comparing a “date started” field with the current date ($now) and then generating numeric reply that lets me know which week my project is in…week 1, 2, 3…etc. I tried playing with the calculations feature but can’t quite figure out the math. Anyone know how to do this? Many thanks.

    May 17, 2015 at 11:19 AM #13744

    Brendan
    Keymaster

    Hi Kuma,

    Well, all date calculations will return results that are in seconds. So you have to use some math to convert those to days. Then you could just divide by 7 to get a week number.

    ($now – [Date Started]) / 60 / 60 / 24 / 7

    May 17, 2015 at 2:22 PM #13745

    Kuma Kato
    Participant

    That explains the crazy long numbers I was getting! Thanks for the quick reply. Works great!

    May 17, 2015 at 7:39 PM #13747

    Brendan
    Keymaster

    Heheh… yup, the number of seconds between the two dates. If you think about it, it makes sense. Imagine if I randomly decided that you could only get hours or days by subtracting dates? Then you’d be screwed if you wanted a result in minutes or seconds.

Viewing 3 reply threads

You must be logged in to reply to this topic.