Dates in C/AL

By | February 5, 2018

Why this pic is here?

Date calculations in NAV may not be that obvious at first, but here are a few use cases that you may come across often which can get you started.

M is for month and C prefixed to it will give current month. Similarly you can get Current Year, Current week etc.



Current Month start date   - CALCDATE('<-CM>',TODAY )
Current Month end date     - CALCDATE('<CM>',TODAY )
Year Start Date            - CALCDATE('<-CY>',TODAY )
Year End Date              - CALCDATE('<CY>',TODAY )
Last year end date         - CALCDATE('<-CY-1D>', TODAY )
3 months back from today's - CALCDATE('<-3M>', TODAY )


Here TODAY is today’s date, you may also check out WORKDATE  which is a flexible way whereby users can specify a date themselves. To specify other dates you have to use format like 010118D which stands for 1’st  January 2018. As you may inferred already, the second parameter of CALCDATE function is the reference date upon which calculation should be based.

For same date last year - CALCDATE('<-1Y>', 010118D )

Microsoft Documentation of CALCDATE you can view here

Leave a Reply

Your email address will not be published. Required fields are marked *