Monday, February 3, 2014

Date functions in AX

Below are some of the Date Functions......

Static Void dateFunctions(Args  _args)
{
Transdate dt;

;
dt = today();

info(strfmt('Date - %1',dt));

//Gets the month for the given date...
info(strfmt("Month - %1",mthofYr(dt)));

/Gets the month name from the given date...
info(strfmt("Month Name - %1",mthname(mthofYr(dt))));

//Gets the day for the given date...
info(strfmt("Day - %1",dayOfMth(dt)));

//Gets the day name from the given date...
info(strfmt("Day Name - %1",dayname(dayOfMth(dt))));

//Gets the year for the given date...
info(strfmt("Year - %1",year(dt)));

//Gets the current weekday number from the date...
info(strfmt("Weekday number - %1",dayOfwk(dt)));

//Gets the day of the year from the given date...
info(strfmt("Day of year - %1",dayOfyr(dt)));

/Gets the week of the year from the given date...
info(strfmt("Week of the year - %1",wkofyr(dt)));

//Gets the date after 2 months from given date
info(strfmt("Date after 2 months - %1",dateMthFwd(dt,2)));

}



No comments:

Post a Comment