In this document:

LibreOffice Writer inserted a date correctly formatted, according to my macro.
This is the format code in the macro:

In a different document:

Using the same macro, LibreOffice Writer inserted the date incorrectly, as a number.
This is the format code in the macro:

The entire code of the macro, as viewed in each document, is identical.
Please tell me why the same code produces a correct format in one document, but not in the other. Both documents were recently created, using the most recent version of OpenOffice.
Please tell me how I fix this.