How to get the day value as a number from a date field

By: Jennifer Mindles | Asked: 11/09/2022
ForumsCategory: How-toHow to get the day value as a number from a date field
Jennifer Mindles asked 2 years ago
How do I get the day portion of a date entered on a form to use in calculations on the same form? I need to know if the date entered is after the 20th so I can calculate a late fee.
1 Answers
Bobby Clapp answered 2 years ago

Maybe try [x format="d"] (x is the field id or key)

Source: https://formidableforms.com/knowledgebase/date/#kb-set-default-to-the-current-date

Jennifer Mindles replied 2 years ago

It gives an error when I display the form on the page: Unexpected identifier 'format'

Bobby Clapp replied 2 years ago

Is the field a date field or is it something else?

Jennifer Mindles replied 2 years ago

I tried with both a numeric and a text field. I put [1583 format="d"] in the Default Value and nothing happened. (1583 is ID of date field I need the day from) I put that in the Default Value Calcuation and get that error.

Bobby Clapp replied 2 years ago

You might have to put that into a field of it's own as the default value. Then reference that field with a math calc condition.

Something like:
([1590] > 500) ? ([1590] * .02) : (10)

Where Condition ? True : False

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right