Tuesday, November 21, 2017

AX - How to get first and last day in month

Use this code:
int iMonth = 6;
int iYear = 2017;

date firstDate = mkDate( 1, iMonth, iYear );
date lastDate = endMth( firstDate );

info( date2str( firstDate, 321, DateDay::Digits2, DateSeparator::Hyphen, DateMonth::Digits2, 
      DateSeparator::Hyphen, DateYear::Digits4 ) );
info( date2str( lastDate, 321, DateDay::Digits2, DateSeparator::Hyphen, DateMonth::Digits2, 
      DateSeparator::Hyphen, DateYear::Digits4 ) );


No comments:

Post a Comment