Days between 2 Dates in C/AL

sc00bysc00by Member Posts: 43
edited 2005-01-12 in Navision Attain
Hmmmm....

Anybody know how to do the eqivalent of the SQL DATEDIFF function in C/AL Code?

Seems like a dead easy one - until you try and find a function :?
Basically it's a date comparision with the result being the integer number of days between date1 and date2.

Thanks (in advance)

Rob.
SELECT * FROM users WHERE clue > 0

0 Records Returned.

Comments

  • DakkonDakkon Member Posts: 192
    This is quite easy to do in Navision. If you have date1 and date2, all you need to do is subtract one from the other. You can assign the result to an integer variable. This result is the number of days btwn the two dates.
    MyInteger := Date2 - Date1;
    

    On a side note if you ever have to find time differences in Navision the same logic can be applied. The only difference is that the resulting value would be the number of milliseconds btwn the two times.

    Hope this helps :D
    Thad Ryker
    I traded my sanity for a railgun :mrgreen:
Sign In or Register to comment.