How to restrict the result of this function DATE2DMY(date,2) to minimum two digits?

How to restrict the result of this function DATE2DMY(date,2) to minimum two digits? Now its giving ‘1’ for January instead of ‘01’. ? I would highly appreciate if you can suggest some workaround to manage this issue.

Not sure whther there is some other way…

you can try

Month := DATE2DMY(010911D,2);
IF STRLEN(FORMAT(Month)) <> 2 THEN
MonthTxt := ‘0’ + FORMAT(Month)
ELSE
MonthTxt := FORMAT(Month);

Message(’%1’,MonthTxt);

If anybody have some other direct solution, please share your experience.

DATE2DMY is a system function, and you cannot change its behavior. That function returns an integer type value. ‘1’ is an integer value, ‘01’ is NOT an integer value but a text value. You will have to create your own wrapper function, take care of conversion, and return a text value that is formatted in the desired manner.