PDF Editing Issues

How to Extract Date of Birth from ID Number in PDF Forms

Algirdas JasaitisAlgirdas Jasaitis Nov 3, 2026 869 views

Question details

The user needs to automatically extract and reformat a date of birth (ddmmyyyy) from a provided ID number formatted as yymmdd####### within a PDF form.

How to Automatically Extract Date of Birth from an ID Number in Acrobat
Product
Adobe Acrobat
Device & OS
not provided
Scenario
Creating an interactive PDF form where entering a user's ID number triggers an automatic calculation to populate the Date of Birth field.
Observed behavior
A calculation script is required, but the two-digit year format (yymmdd) in the ID number creates a century ambiguity (e.g., 2018 vs 1918) that must be resolved.
Before you start

Before writing your calculation script, decide on a century rule (e.g., treating years above 25 as 1900s, and below as 2000s) or add a specific form field to capture the correct century.

Solution 1Recommended

Implement a Custom JavaScript Calculation with a Century Rule

Use JavaScript in the PDF form field properties to extract the characters and apply logic to determine the correct century.

Since a two-digit year lacks century context, a calculation script must mathematically or logically determine whether the year belongs to the 1900s or 2000s. Setting a pivot year is the most common automated approach.

1
Open Prepare Form Mode

Open your PDF document in Adobe Acrobat, navigate to the Tools menu, and select 'Prepare Form' to enter editing mode.

2
Access Field Properties

Right-click the target 'Date of Birth' text field where the extracted date should appear, and select 'Properties'.

3
Add Custom Calculation Script

Click the 'Calculate' tab, select 'Custom calculation script', and click the 'Edit' button.

4
Write Extraction Logic

Enter JavaScript to extract the substrings. For example: var id = this.getField('IDNumber').value; var yy = id.substring(0,2); var mm = id.substring(2,4); var dd = id.substring(4,6);.

5
Apply Century Rule

Add an if-statement to append the century (e.g., if(Number(yy) > 25) { year = '19' + yy; } else { year = '20' + yy; }), then output the final string in ddmmyyyy format by setting event.value = dd + mm + year;.

Implement a Custom JavaScript Calculation with a Century Rule
Test Your Script: Always test your form with various ID numbers, especially those born near your pivot year, to ensure the century calculates accurately.
Efficient PDF Form Management

Edit and Manage PDF Forms Easily with WPS Office

WPS Office provides a comprehensive PDF editor that allows you to effortlessly view, edit, and fill interactive forms. It simplifies document management without the need for complex software.

  1. 1. Install WPS Office: Download and install the free version of WPS Office from the official website.
  2. 2. Open Your PDF: Launch WPS Office, switch to the PDF tab, and open your PDF form directly within the WPS PDF Editor.
  3. 3. Fill or Edit the Form: Use the integrated Form tools to fill interactive text fields, add signatures, or modify PDF content effortlessly.
Advanced PDF form filling, reading, and text editing capabilities.High compatibility with Microsoft Word, Excel, PowerPoint, and Adobe PDF formats.Cross-platform support for Windows, Mac, iOS, and Android.Lightweight, fast, and completely free to download.
microsoft office alternative - wps office

Frequently Asked Questions

Why does my PDF script extract the wrong century from an ID number?

A two-digit year (like '18') lacks century context. You must implement a logic rule in your JavaScript (such as treating numbers under 30 as 2000s) to parse it correctly, otherwise the script does not know if it means 1918 or 2018.

Can I extract data without using JavaScript in a PDF form?

For simple text duplication, you can name two fields identically to mirror their content. However, transforming a complex string like 'yymmdd' into 'ddmmyyyy' requires custom JavaScript calculations.

How do I access the calculation script window in Adobe Acrobat?

Enter Prepare Form mode, right-click the target field, choose Properties, navigate to the Calculate tab, select 'Custom calculation script', and click the Edit button to open the JavaScript editor.