Basic Date Calculations

 

Hey Friends,

This Post is all about DATE. I saw many people getting stuck as whenever there needs some date calculation logic and the only reason behind this is that there are too many permutation and combinations that comes into play whenever we start creating our logic. So I just though to add a post where I can add all those very commonly needed outcomes.

FirstDayOfMonth := CALCDATE (‘<CM-1M+1D>’, Today);

LastDayOfMonth := CALCDATE (‘<CM>’, Today);

FirstDayOfPreviousMonth := CALCDATE (‘<CM-2M+1D>’, Today);

LastDayOfPreviousMonth := CALCDATE(‘CM’,CALCDATE(‘-CM-1D’,TODAY));

Day := DATE2DMY(TODAY, 1);

Month := DATE2DMY(TODAY, 2);

Year := DATE2DMY(TODAY, 3);

WD4 The next 4th day of a week (Thursday)
CM+10D Current Month +10D
10D 10 Days from today
CW Last date of the current week (Sunday)
CM Last day of the current month
CQ Last day of the current quarter
CY Last day of the current year
1Y    1 Year ago from today
CY-2Y+1D First Day of last fiscal year
CY-1Y Last Day of last fiscal year
2W 2 weeks from today
D10 The next 10th day of the month

I will go on increasing this list. This will anyhow save our time.

There’s a virtual Table called DATE. I always remind and recommend everyone to use this Table, it really makes the work a more easier. 

CHEERS

2 comments on “Basic Date Calculations

  1. Pingback: Basic Date Calculations - Microsoft Dynamics NAV Community

  2. Pingback: Basic Date Calculations - Dynamics NAV by RockWithNAV - Dynamics NAV Users - DUG

Leave a comment