Get the day of the week from a date field
I have a date field that is formatted as "mm/dd". This field is named "DATE1".
I would like to have another field that looks at DATE1 and returns the day of the week of DATE1. The output of the field would be Sun, Mon, Tue, Wed, Thu, Fri, or Sat.
I have tried to use this code, but I have not had any luck...
// get the date from the "Date1"
var d = new Date(this.getField("Date1").value);
if (!isNaN(d.getDay()))
{
switch (d.getDay())
{
case 0:
event.value = "Sun";
break;
case 1:
event.value = "Mon";
break;
case 2:
event.value = "Tue";
break;
case 3:
event.value = "Wed";
break;
case 4:
event.value = "Thu";
break;
case 5:
event.value = "Fri";
break;
case 6:
event.value = "Sat";
break;
default:
event.value = "O"; // we don't have a valid day
}
}
else
{
event.value = "P";
}
If there is an easier solution I am all for that too. (Adobe Acrobat Pro DC)
Thanks for your help.
