How to extract the day from my date picker field?

  • Sharon Owen
    Asked on January 25, 2023 at 6:54 PM

    I just need the day digit to use in a pro-rate form for rental. I see Days() looks like it pulls out this number, but I get the days since 1970. I just want the number 20 in a jan 20, 2023 example.

  • Raymond JotForm Support
    Replied on January 26, 2023 at 12:49 AM

    Hi Sharon,

    Thanks for reaching out to Jotform Support. To extract the day from your date picker, we have to use the Substring widget. Let me show you how to do it:

    • In Form builder, click on the Add element Menu on the left.
    • Under the Widgets tab, search and click on the Substring widget.
    • 1674711958 63d213963d82b  Screenshot 10

    Now we have to get the Field ID of the date picker and insert it within the Substrings Souce Field ID.

    • Click on the Gear icon over your Date Picker and click on the Advanced tab.
    • Copy the Field ID for the day, it is "#day_2" in my example.
    • 1674712018 63d213d23c893  Screenshot 21
    • Then open your Substring widget by clicking on its Wand icon and paste it to the Source Field ID. Indicate the substring start to 0 and end to 2 as well.
    • 1674712099 63d2142321523  Screenshot 32

    If you wish to perform calculations with this, I suggest linking your Substring widget within a form calculation widget which you can use to perform calculations.

    1674712155 63d2145b4b2a5  Screenshot 43

    Here's a link to a test form you can check.

    Give it a try and let us know if you need any help.