AX – D365FO – Get first and last day of a month

X++ Get Start Date and End Date of Month

Use following methods to get Month Start Date and Month End Date. Pass any date of month in parameter.

Month Start Date : 

 TransDate dateInMonth=today();  
 TransDate firstDateOfMonth;  
 ;  
 firstDateOfMonth = DateStartMth(dateInMonth); 

Month End Date :

 TransDate dateInMonth=today();  
 TransDate endDateOfMonth;  
 ;  
 endDateOfMonth= endmth(dateInMonth);

Leave a comment