How can I extract the Month and Day from the Date Picker field?

  • Jim_Firth
    Asked on September 20, 2022 at 6:21 PM
    but my objective is to auto-calculate the date medical benefits become effective, which is always the first day of the month in which 90 days have transpired from their start date. Is there a way to extract just the moth and day from a date field?
  • Raphael_V
    Replied on September 20, 2022 at 7:05 PM

    Hi Jim,

    Thanks for reaching out to us for help. There is a way for you to extract just the Month and the Day from the Date Picker field. You would need to utilize our Substring Widget. Let me show you how to do it:

    • In your Form Builder, click on the Add Form Element menu, go to the Widgets tab, search for Substring and add two(2) of them to your form.

    1663712874 632a3e6a0ec19  Screenshot 10


    Next, you would need to get the Field IDs of your Date Picker field for the month field and the day field. You can check out this article on How to Find the Fields’ IDs. Here's how:

    • In your Form Builder, select the Date Picker field, click on the Gear icon, go to the Advanced tab, scroll down and click on the Field Details dropdown arrow to find the Field IDs box.

    1663713260 632a3fecd3817  Screenshot 21

    • Now, insert the Month Field ID (#month_3) into the first Substring Widget, and Day Field ID (#day_3) into the second Substring Widget.
    • Put the number zero(0) inside the Substring start box, then put the number two(2) inside the Substring end box.

    1663713553 632a4111eed16  Screenshot 32


    This will extract the Month and Day of the Date Picker field separately. Here's the result:

    1663713855 632a423f5cdab  Screenshot 43


    If you want to display the Month and Day inside one(1) field, then you will need to use our Form Calculation Widget. Here's how to do it:

    • In your Form Builder, click on the Add Form Element, select the Widgets tab, search for the Form Calculation widget, and add it to your form.
    • In the Form Calculation Widget Settings, click on the Add Field Button, select the two Substring Widgets fields for Month and Day, then click on Save.

    • You can follow this formula: SubstringMonth - SubstringDay
    • 1663714968 632a46985cc6d  Screenshot 54

    1663714660 632a456460e60  Screenshot 65


    Here's the result:

    1663715048 632a46e8d4033  Screenshot 76


    Keep in mind that you would need to repeat this process if you want to use it on all your Date Picker fields in your Form.

    That's it. Let us know if there’s anything else we can help you with.