Copy link to clipboard
Copied
I am looking for a date picked from a date field to be transposed into a text box, but in a different format and preferably in different boxes.
Date Field -
saledate: 11/19/2025
Text boxes-
text1: Nov
text2: 19
text3: 25
Is this possible?
Copy link to clipboard
Copied
There are several ways this could be done. Here's a simple and straight forward method.
Use this script in the Custom Validation script for the date field:
// validate date entry first
if(/\d{1,2}\/\d{1,2}\/\d{4}/.test(event.value))
{
var dtValue = util.scand("mm/dd/yyyy",event.value);
this.getField("text1").value = util.printd("mmm",dtValue);
this.getField("text2").value = util.printd("dd",dtValue);
this.getField("text3").value = util.printd("yy",dtValue);
}
Copy link to clipboard
Copied
There was something I was clearly doing wrong yesterday, because it worked just fine this morning! I still attached the PDF for anyone seeing this in the future 🙂
Thanks, Thom!
Copy link to clipboard
Copied
There are several ways this could be done. Here's a simple and straight forward method.
Use this script in the Custom Validation script for the date field:
// validate date entry first
if(/\d{1,2}\/\d{1,2}\/\d{4}/.test(event.value))
{
var dtValue = util.scand("mm/dd/yyyy",event.value);
this.getField("text1").value = util.printd("mmm",dtValue);
this.getField("text2").value = util.printd("dd",dtValue);
this.getField("text3").value = util.printd("yy",dtValue);
}
Copy link to clipboard
Copied
Just a small error — you’re writing all three values into text1, instead of text1, text2, text3.
Copy link to clipboard
Copied
Good catch
Copy link to clipboard
Copied
I'm running into an issue with the date field. It will not pull this data if it's a date field. If I remove the date format in properties, and the date box then turns into a text box, only then does it work.
Copy link to clipboard
Copied
So, there really isn't a special kind of Date Field in a PDF. It's just a text field with date formatting. If the script works only when the formatting is removed, then there is a problem with the formatting. What exactly is the date format being used?
Copy link to clipboard
Copied
mm/dd/yyyy
Copy link to clipboard
Copied
That should work just fine. Can you post the form?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Excellent! Sometimes things don't get saved correctly. Or Acrobat needs to get kicked. It's never a bad idea to close and reopen a file, or close and reopen Acrobat, so that the memory is refreshed.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more