How to Display Only the Year in an Acrobat PDF Date Field
Question details
The user wants to display only the four-digit year in a PDF form field that receives a full date entry in MM/DD/YYYY format.

- Product
- Device & OS
- not provided
- Scenario
- Designing or filling out a PDF form where a complete date is inputted, but visually only the year needs to be displayed.
- Observed behavior
- Setting a custom format of 'YYYY' fails because it is not recognized as a complete and valid date format for standard PDF date fields.
Ensure you have a professional PDF editor with form-building capabilities, such as Adobe Acrobat Pro or WPS Office, to access and edit custom calculation scripts.
Use a Calculation Script in a Separate Text Field
Since 'YYYY' is not a valid date format on its own, you must keep the original date field and use a new text field to calculate and display the extracted year.
A custom format of 'YYYY' is not recognized as a complete date format for standard PDF date fields. To resolve this, you can hide the original full-date field and create a secondary text field. This new field will use a custom JavaScript calculation to automatically extract and display just the year from the source field.
Maintain your original date field (e.g., named 'FullDate') that successfully receives the MM/DD/YYYY input from users or services.
Select the 'Add Text Field' tool from your PDF form editing menu and place it where you want the year to appear. Name this new field 'YearDisplay'.
Right-click the new 'YearDisplay' text field and select 'Properties'. Navigate to the 'Calculate' tab.
Choose the 'Custom calculation script' option and click 'Edit'. Enter a JavaScript snippet that targets the original field to extract the year (for example, using a substring method to pull the last 4 characters of the date string).
If you do not want the full date visible on the document, open the 'Properties' of the 'FullDate' field, go to the 'General' tab, and change its 'Form Field' visibility setting to 'Hidden'.

Design and Edit PDF Forms Seamlessly with WPS Office
WPS Office provides a comprehensive PDF editor that allows you to add, modify, and manage form fields easily. Handle dates, text fields, and custom form formatting without hassle.
- 1. Open your PDF: Launch WPS Office and open your PDF form document.
- 2. Access the Form tab: Navigate to the 'Form' tab on the top ribbon to view all interactive form editing tools.
- 3. Add Text Fields: Click 'Text Field' from the toolbar to insert new fields for data extraction or year display.
- 4. Edit Properties: Double-click the inserted field to open its properties, where you can adjust formatting, visibility, and calculations.

Frequently Asked Questions
Why can't I just set the date field format to 'YYYY'?
In standard PDF form properties, 'YYYY' does not constitute a complete date. The system requires a full date (day, month, and year) to recognize it as a valid date object and format it correctly.
Can I hide the original date field so only the year shows?
Yes. You can set the original full-date field's visibility to 'Hidden' in its Properties under the General tab. This keeps the data intact in the background while only the extracted year field remains visible to the reader.
Does extracting the year alter the original form data?
No. By using a separate text field with a calculation script, your original date field retains the complete MM/DD/YYYY data securely while the new field merely visually displays the year.




