Convert date string to YYYY (Year) and copy value to another field
Hello;
I'm looking for a script that will take a user's input of mm/dd/yy, convert the year to YYYY and copy this value to another field in the document's header. I think I almost had it at a certain point but I'm clearly lost now.
Here's what I've been able to put together. Is there any way that this can be done? I appreciate your help.
// convert date to yyyy and copy value to Specimen 1 Date Collected field in form header
var d = new Date (this.getField("Specimen 1 Date Collected").value);
var today = new Date();
if ((today.getFullYear() - d.getFullYear()) >= 100) {
this.getField("Specimen 1 Date Collected Header").value = d + 100;
} else {
this.getField("Specimen 1 Date Collected Header").value = d;
}
