Convert Local Date and Time to UTC in an Acrobat PDF Form
Question details
Convert a date and time entered in one PDF form field from local time to UTC in another field.

- 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.
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.
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.
In Acrobat, open the PDF and choose All tools > Prepare a form. Find the input field and note its name.
Create or select the UTC text field, open its Properties, and choose Calculate > Custom calculation script > Edit.
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;
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.

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.

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.




