# Date/Time Calculations

Hi. I have done a small amount of coding before in Navision but only in reports. My question is, how do I create a formula on Date & Time fields. I would like to take one date from another to leave a remainder and the same for times. eg: “Actual Date”(31/12/01) - “Booked Date”(28/12/01) = Variance(3); “Actual Time”(12:00:00) - “Booked Time”(11:30:00) = Variance(30); How is this possible[?] I have not seen anything in the Help file on this. Many Thanks

You can use date/time in calculations directly. ie int = WORKDATE - “Posting Date” returns an integer with the number of days difference dt = WORKDATE + 3 returns a date 3 days later than workdate. Time works the same except the return is milliseconds intMS = “Actual Time” - “Booked Time” = 1,800,000 ms

Hi Thanks for your help. I have now got the results I need on the date calculations. I have also found out how to calculate the Times, but the results are calculated in milliseconds. How do I get this back to minutes? I have tried multiplying by 3600000 but the result seems to be in decimal and not minutes[?]

OK I’ve sorted it.

If you are working with the 3.60 release you might want to check out the new datatypes: DATETIME and DURATION.