Subtract two dates


When I subtract two dates, it gives me the answer in dd:hh:mm:ss format.

I need only the date>

How do I get date only?

I don’t see how subtracting one date from another could ever result in another date.

It should result in an integer that is the number of days between the two…

What is the C/AL statement you are using? And what are the variables involved?

Getting the format “dd:hh:mm:ss” indicates that your value is formatted when displayed or printed. Did you look at your code and/or preperty for the result?

Hi Barathy & Welcome to Dynamics User Group.

As Tony said, it will be the integer and equal to no. of days between two dates, for example:


The above code subtracts today’s date from 1st January, 2010 and gives me result as no. of days between two dates (in this case, 37).

Hope it helps


Thank you very much for your help.

When I use Datediff(“d”, date1, date2) , I got the two digit date like 36.

Thank you


Are you sure you posted this to the right forum? There is no DateDiff function inside Navision.