How to convert from date to string using x++ in ax 2009 ?

When you need to convert from date to string in x++ it's need many parameters in the function that convert from date to string i'll explain with simple example :
void DateTStringConvert()
{
date today=today();
str TodayDate;
;
 TodayDate = date2str( today,321,DateDay::Digits2,DateSeparator::Slash,DateMonth::Digits2,DateSeparator::Slash,DateYear::Digits4);
info(TodayDate );
}

Note :

The function date2str  take following parameters :
1- the date .
2- the date style dmy or ymd or....etc .
3- number of digits for day .
4- separator
5- number of digits for month.
6- separator
7- number of digits for year.

now you can use the date as string




Comments

momogrosir said…
thanks you. it work

Popular Posts