How to Create a Custom YMM Date Format in Microsoft Word
Question details
The user needs to generate a specific three-digit date code consisting of a single-digit year and a two-digit month (e.g., 312 for December 2023) in a document template.

- Product
- Microsoft Word
- Device & OS
- not provided
- Scenario
- Creating a custom document template that requires an exact three-digit date format to streamline data entry or tracking codes.
- Observed behavior
- Native Word date fields and date picker controls do not consistently support a single-digit year format, often outputting four digits (such as 2312) when using the yMM format switch.
Ensure you have basic familiarity with Word's field codes, and consider enabling the Developer tab if you need to use VBA macros for strict formatting control.
Use Field Codes for YMM Formatting
Modify Word's built-in Date field to approximate the YMM layout using field switches.
Microsoft Word allows users to customize date outputs using field switches. While the 'y' switch attempts to isolate the year, be aware that depending on your Word version and the current year, it might yield a two-digit year instead of a single digit.
Navigate to the 'Insert' tab on the Word ribbon, click on 'Quick Parts' in the Text group, and select 'Field'.
In the Field dialog box, select 'Date and Time' from the Categories dropdown, then choose 'Date' from the Field names list.
Click the 'Field Codes' button at the bottom left. In the advanced view, type the format switch directly into the code box so it reads: { DATE \@ "yMM" }.
Click 'OK' to insert the field. Right-click the inserted date and select 'Update Field' to see the result. Verify if the output matches your required three-digit format.

Create a VBA Macro for Strict Three-Digit Output
Use a custom VBA macro to precisely extract the last digit of the year and the two-digit month, ensuring a strict three-digit result every time.
Manage Custom Field Codes Easily with WPS Writer
WPS Office provides a highly compatible, lightweight, and intuitive environment for handling complex document fields. You can seamlessly insert and edit custom date formats exactly as you would in Microsoft Word.
- 1. Open Your Document in WPS Writer: Launch WPS Office and open your existing document or create a new template.
- 2. Access the Field Menu: Navigate to the 'Insert' tab, click on 'Field' to open the field management dialog box.
- 3. Apply Custom Date Formatting: Select the 'Date and Time' category, insert a Date field, and modify the field code to { DATE \@ "yMM" }.
- 4. Update the Field: Right-click the inserted field and choose 'Update Field' or simply press F9 to refresh the date output instantly.

Frequently Asked Questions
Why does my yMM date field show four digits instead of three?
In Word, the 'y' format switch can sometimes default to a two-digit year depending on the system's date settings and the specific year. When combined with a two-digit month (MM), this results in a four-digit output (e.g., 2312) instead of the desired three.
Can I use a Date Picker Content Control for this specific format?
While Date Picker Content Controls allow you to specify custom date formats in their properties, they rely on the same underlying formatting rules as field codes. They may still fail to produce a strict single-digit year.
How do I edit an existing date field code in Word?
To edit an existing field, select the date text in your document and press 'Alt + F9' to toggle the display of field codes. You can then manually change the text inside the brackets, for example updating it to { DATE \@ "yMM" }. Press 'Alt + F9' again to hide the codes, and press F9 to update the result.




