Adjust Date Format on Check?

Hello,

I need some help adjusting the date format on my checks. Currently the date is in a mm/dd/yyyy format I need to change it to a dd/mm/yyyy format. It would also be helpful if I could add in some spacing between the day, month and year. I am trying to fit it into a predefined check layout on the printing paper. Below is the code that I currently have. any help that you can provide would be much appreciated.

display str 30 LongDate()

{

return strFmt(’%1’, date2str(tmpChequePrintout.transDate,-1,2,0,2,0,4));

}

Hi

Use below code, it might works for you.

int monthofDate = mthofyr(systemDateGet());
int day = dayofmth(systemDateGet());
int yearOfDate = year(systemDateGet());

return strfmt("%1/ %2/ %3",day,monthofDate,yearOfDate);

Thanks
Amir Nazim
Blog:http://msdax.wordpress.com/

It doesn’t seem to be working. I removed the old code and added what you suggested and it seems to be giving me syntax errors.

Thanks for the suggestion though.

Hi Matt,

Looks you are calling date2str function incorrectly. Correct syntax below -


date2str(ActualDate, //Date
123, //Sequence
2, //Day
-1, //Separator1
2, //Month
-1, //Separator2
4)); //Year


Regards,

So I need to declare the ActualDate variable correct? Sorry i am really new at this X++ thing.

Hi Matt,

It was meant as an example. Replace 'ActualDate; with ‘tmpChequePrintout.transDate’

Regards,

Hi Matt,

Currently the date is in a mm/dd/yyyy format and you need to change it to a dd/mm/yyyy format. You should write your method as shown below:

display str longDate()

{

;

return date2str(tmpChequePrintout.transDate,213,2,-1,2,-1,4);

}

For user interface situations, use strFmt or date2Str with -1 in all the formatting parameters. This ensures that the date is formatted in the way that the user has specified in Regional Settings.

If you find any issues please revert back.

Thanks & Regards,
Shankar Dutt Sharma