Skip to main content
Participating Frequently
June 10, 2024
Answered

Day of Week Date Display (Full date display)

  • June 10, 2024
  • 1 reply
  • 1616 views

I am preparing a form and want users to select dates.
When they do, I want the date displayed with the day of the week.
For example, if they select June 9th, 2024 from the date picker, I want it to display as Monday, June 20th, 2024.
How do I do this?

This topic has been closed for replies.
Correct answer PDF Automation Station

In the format tab select Date, then Custom, then enter the following into the field:

dddd, mmmm dd, yyyy

It won't give you the st, nd, rd in 1st, 2nd, 3rd, etc.  You would have to write a custom function for that.

1 reply

PDF Automation Station
Community Expert
Community Expert
June 10, 2024

In the format tab select Date, then Custom, then enter the following into the field:

dddd, mmmm dd, yyyy

It won't give you the st, nd, rd in 1st, 2nd, 3rd, etc.  You would have to write a custom function for that.

ZoeiAuthor
Participating Frequently
June 10, 2024

Thanks!

What custom function should I write for the suffixes?

PDF Automation Station
Community Expert
Community Expert
June 11, 2024

In the format tab, enter the following custom format script:

AFDate_FormatEx("mm/dd/yyyy");
var date=util.scand("mm/dd/yyyy", event.value);
function ordinal(n)
{
var s = ['th', 'st', 'nd', 'rd'];
var m = n % 100;
return n + (s[(m - 20) % 10] || s[m] || s[0]);
};

event.value=util.printd("dddd, mmmm ",date)+
ordinal(util.printd("d",date))+
util.printd(", yyyy", date);

And enter the follow custom keystroke script:

AFDate_KeystrokeEx("mm/dd/yyyy");

These 2 articles explain how the custom format scripts work and how to find the scripts:

https://pdfautomationstation.substack.com/p/custom-format-for-pdf-fields

https://pdfautomationstation.substack.com/p/more-custom-formatting-for-pdf-fields