PDF Editing Issues

Convert Local Date and Time to UTC in an Acrobat PDF Form

Tauseeq MagsiTauseeq Magsi Nov 19, 2026 869 views

Question details

Convert a date and time entered in one PDF form field from local time to UTC in another field.

Convert a Local Date and Time to UTC in an Acrobat PDF Form
Product
Adobe Acrobat PDF forms
Device & OS
not provided
Scenario
A user enters a local date and time in dd-mmm-yy hh:mm format and needs the corresponding UTC value.
Observed behavior
The UTC field should reflect the entered date and time rather than the current system time.
Before you start

Check the name of the field containing the local date and time, and confirm that the computer's time zone matches the time zone represented by the entry. Open the form in Acrobat with form editing and JavaScript calculations available.

Solution 1Recommended

Calculate UTC from the entered local time with Acrobat JavaScript

Use a custom calculation script in the output field to parse the entered value and display its UTC equivalent.

The script treats the entry as local time in the computer's configured time zone. It uses the entered date's time-zone offset, which can differ from today's offset because of daylight saving time.

This example interprets years 00–49 as 2000–2049 and years 50–99 as 1950–1999. A two-digit output year does not identify the century.

1
Open the form editor

In Acrobat, open the PDF and choose All tools > Prepare a form. Find the input field and note its name.

2
Open the output field calculation

Create or select the UTC text field, open its Properties, and choose Calculate > Custom calculation script > Edit.

3
Add the conversion script

Paste the following script, replacing LocalDateTime with the exact input field name: var raw = String(this.getField("LocalDateTime").valueAsString).replace(/^\s+|\s+$/g, ""); var match = /^(\d{2})-([A-Za-z]{3})-(\d{2})\s+(\d{2}):(\d{2})$/.exec(raw); var months = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"]; var result = ""; if (match) { var month = -1; for (var i = 0; i < months.length; i++) { if (months[i] === match[2].toLowerCase()) month = i; } var day = Number(match[1]); var yy = Number(match[3]); var year = yy < 50 ? 2000 + yy : 1900 + yy; var hour = Number(match[4]); var minute = Number(match[5]); var d = new Date(year, month, day, hour, minute); if (month >= 0 && d.getFullYear() === year && d.getMonth() === month && d.getDate() === day && d.getHours() === hour && d.getMinutes() === minute) { var pad = function (n) { return n < 10 ? "0" + n : String(n); }; result = pad(d.getUTCDate()) + "-" + months[d.getUTCMonth()] + "-" + pad(d.getUTCFullYear() % 100) + " " + pad(d.getUTCHours()) + ":" + pad(d.getUTCMinutes()); } } event.value = result;

4
Save and test the form

Close the script editor, save the PDF, and enter a value such as 15-jun-25 14:30 in the input field. Check the UTC field against a trusted conversion for the computer's time zone and that date.

Calculate UTC from the entered local time with Acrobat JavaScript
Daylight saving time and invalid entries: Invalid dates and local times that do not exist during a daylight-saving transition produce a blank result. A repeated local time during a fall transition can be ambiguous; include an explicit time-zone offset if the exact occurrence must be identified.
Free Microsoft Office alternative

Work with PDF and Office files in WPS Office

WPS Office is a free, lightweight Office alternative with a familiar interface and Microsoft Office format compatibility for easier migration. Use its PDF tools for everyday document work; it does not replace Acrobat's custom form JavaScript calculation.

Open and work with PDF documents alongside Office files.Compatible with Microsoft Word, Excel, and PowerPoint formats.Use a familiar interface for a smooth transition from Microsoft Office.Access free, lightweight tools for common document tasks.
microsoft office alternative - wps office

Frequently Asked Questions

Why shouldn't I use the current time-zone offset for the conversion?

The offset may be different on the entered date because of daylight saving time. Constructing a Date from the entered local value and using its UTC methods applies the offset for that date.

Why is the UTC field blank?

Check that the input field name in the script matches the field name in Prepare a form. The entry must use dd-mmm-yy hh:mm, such as 15-jun-25 14:30; invalid or nonexistent local times also return a blank value.

Can the form convert a time from a different time zone?

The script uses the computer's configured time zone, not an arbitrary time zone entered by the user. For another zone, the form needs an explicit offset or a separate time-zone-aware conversion method.

Will the calculation work in every PDF viewer?

No. The script depends on support for Acrobat form JavaScript and field calculations. Test the saved form in the PDF viewer that recipients will use.