Docs & Support

Learn about all the Formidable features and get support from our amazing customer success team.

Date

— Premium Feature —

The Date field allows users to type in a date or select it from a pop-up calendar. A Date field stores values in the Y-m-d format but the field displays dates in the format selected in your Formidable Global Settings. Date Field Calendar

For more advanced options, see the Datepicker Options add-on.

Standard field options

A Date field has the following standard options: Date field optionsDate field options

Formidable Forms makes advanced site building simple. Launch forms, directories, dashboards, and custom WordPress apps faster than ever before.

Field specific options

In addition to the standard field options, a Date field has a few field specific options. Plus, there are more powerful options available in the Datepicker Options add-on.

Calendar localization

Choose which language you would like your calendar to display.

Year Range

If you would like to set a dynamic year range for a date field calendar, you may insert -50 for the Start Year and +0 for the End Year as shown below:

This will set the start date to 50 years ago and the end date to the current year. You may change 50 and 0 to any integer.

Date field styling

To change how the datepicker looks, go to your form Styles page. Select your preferred style, click the Edit link, and find the Date fields section. Here, you can change the color of the header, text, and band. You can style a datepicker for each style.

Date field StylingDatepicker field

To learn more about styling your form, see the visual form styler page.

Default values and field icons

The default value icons can be used to specify whether the text entered in a Date field on the form builder page should be a default value or a placeholder. Learn how to set a default value and how to set a placeholder in a Date field.

Field action icons allows you to duplicate, delete, and/or move a field on the form builder page. See the field action icons article for more information.

Set default to the current date

Autopopulate a Date field with the current date by inserting the [date] shortcode in a field. By default, this will display the current date in the format selected in your Formidable Global Settings. If you would like to display a specific format, use the following shortcode:

[date format="m/d/Y"]

You may replace m/d/y with any of the accepted PHP date() format characters.

Using current date in form action

If you want to set the conditional logic of a form action based on the current date, you can use the [date] shortcode in the form action conditions. For example, if you want to conditionally send an email when a date field has passed or hasn't passed today's date, it will compare the current date every time the entry is created or updated. In your form action, add conditional logic that says the Date is greater than [date format="Y-m-d"] Using current date in form action conditional logic

Display date fields

Display the value submitted in a Date field in a form's confirmation message, email, or View.

  • Display date

    Display the value submitted in a Date field. By default, the date will be displayed in the format entered in your WordPress → Settings → General page in the 'Date Format' setting.

    [x]

    Replace x with the ID or key of the Date field.

  • Display a specific date format

    Display the value submitted in a Date field with the format of your choosing. You may use any of the PHP date() allowed format characters.

    [x format="m/d/Y"]

    Replace x with the field ID or key of the Date field.

  • Time ago

    Display the number of days, weeks, months, or years ago the entered date is from today's date. This also calculates dates in the future for countdowns.

    [x time_ago=1]

    Replace x with the field ID or key of the Date field. See more time_ago options.

  • Offset

    Calculate a date by adding or removing a set amount of time. For example, calculate a pregnancy due date by adding a set number of days to the selected date.

    [x offset="+280 days"]

    Replace x with the field ID or key of the Date field.

    For more flexibility, you can combine time_ago and offset. Our pregnancy due date example shows the number of weeks until the calculated due date with:

    [x offset="+280 days" time_ago=week]

Compare date fields

Use the [date_calc] shortcode to compare date fields. Place the shortcode inside a Default Value (Calculation) in the field options. Date Calc Quantity Booking form

For example, if the first date selected is the current date and the second date being compared is five days ago, various options will return different results. Here are a few examples:

Shortcode Result
[date_calc id=536 compare=541 format=days]
-5
[date_calc id=536 compare=541 format=days abs=1]
5

Replace 536 and 541 with the ID or key of the date fields to compare.

Parameters

  • compare

    Use this option to compare a date field with a specific date.

    [date_calc id=536 compare="2020-01-01" format=days abs=1]

    Replace 536 with the ID or key of the Date field and replace 2020-01-01 with your preferred date.

  • count_blackout_dates

    By default, the [date_calc] shortcode will automatically exclude blackout dates when using the format="days" option. Use this option to include the blackout dates in the date calculation.

    [date_calc id=536 compare=541 format=days abs=1 count_blackout_dates="1"]

    Replace 536 and 541 with the ID or key of the date fields to compare.

Create a booking form

If you want to create a booking form where users can select a check-in and check-out date, and calculate the total amount to be paid, follow the instructions below.

  1. Add two date fields to your form: Check-in Date and Check-out Date. Date Calc Check-in Check-out Booking form
  2. For the Check-in Date, set [date] as the default value to get the current date.
    TIP: If you have the Datepicker add-on installed, you can set the minimum date to the current date to prevent previous dates from being selected.
  3. Add a product field and name it Room Type. It is the field where the users can choose which room they want to book.
  4. Add your products and their corresponding price. For example:
    • Deluxe Room = 100
    • Suite Room = 300

    Date Calc Room Type Booking form

  5. Add a quantity field and name it Quantity. It is the field where the number of nights per stay will be compared. Set this to Read Only in the field options. In the field options, select the calculator icon in the Default Value section. Insert this calculation into the box: Date Calc Quantity Booking form
    [date_calc id=536 compare=541 format=days abs=1]

    Replace 536 and 541 with the ID or key of the date fields to compare.

  6. Add a total field and name it Price. It is the field where the total price will be calculated.
    TIP: You can use the built-in frm_total_big CSS layout class to highlight the price.

    Date Calc Total Price Booking form

Calculate an age

See the Field Calculation page for step by step instructions on how to calculate a users age.

Calculate difference in days in a form

To show the difference between two Date fields, you can use a simple numerical Calculation. In the calculations box, put: [end-date] - [start-date], where end-date is the id or key of the end Date field and start-date is the id or key of the start Date field.

Show difference in days in a View

Use this shortcode in a View to show the difference in days between two date fields or a date field and the current date. Use the start and finish parameters to indicate the start and finish dates. If you don't include a start or finish parameter, the current date will be used for that parameter. To use [created-at], add a format that only has day, month, and year.

Usage:

  • [frm-days-diff start="[100]"]: Days since the date in field 100
  • [frm-days-diff start="[100]" finish="[101]"]: Days between the dates in fields 100 and 101
  • [frm-days-diff start="[created-at format='d-m-Y']"]: Days since the entry was created
add_shortcode( 'frm-days-diff', 'frm_days_diff' );
function frm_days_diff( $atts ){
	extract( $atts );

	$startdate = isset( $start ) ? new DateTime( $start ) : new DateTime();
	$finishdate = isset( $finish ) ? new DateTime( $finish ) : new DateTime();
	
        $interval = $startdate->diff( $finishdate );

	//Uncomment statement below to show + or - before number of days
	//return $interval->format( '%R%a days' );
   
	return $interval->format( '%a days' );
}

Prevent typing into date fields

Follow these instructions if you want to force your users to select dates using the datepicker and not by manually typing in the date.

Vary schedule for each day

Using a date field and time fields is useful to have separate schedules for different days of the week. One of the most common scenarios is when availability is reduced on Fridays and Saturdays. The directions below can be adapted to apply to this use case.

  1. Add a Date field in your form.
  2. Add a Hidden field. Set the numeric calculation to get the day of the week of the selected date. With Sunday as 0 and Saturday as 6. Date Field Schedule Hidden Field In the default value (calculation), insert this calculation:
    new Date([320]*24*60*60*1000).getDay()

    Replace 320 with the id or key of your Date field.

  3. Add a Time field for your regular (Sunday - Thursday) time selections and set the conditional logic to show the regular time field when the Hidden field is less than 5. Date Field Schedule Conditional Logic Less
  4. Add another time field for your Special (Friday and Saturday) time selections and set the conditional logic to show this time field when the Hidden field is greater than or equal to 5. Date Field Schedule Conditional Logic Greater
  5. When the user selects a date in the Date field, it will show the corresponding time field depending on the day of the week selected. Date Field Schedule Time

Troubleshooting

Datepicker not working

If your calendar does not pop up, then you may be missing the wp_footer hook in your theme. It is also possible that you have a JavaScript error on your page. Please review this FAQ to find and fix the problem. If you are unable to find the problem, please create a ticket in our help desk.

Often, if the datepicker calendar is not appearing, the problem can be solved simply by clearing any caches on your site and in your browser.

Missing month and year field text

If you're not seeing any text on the datepicker month and year fields, your theme might be introducing this conflict. To override this, you can use the custom CSS below to change it to a darker color which will make it more visible. You can add this to your Formidable → Global Settings → Custom CSS page.

.ui-datepicker .ui-datepicker-title select {
   color: #333 !important;
}

Set datepicker width

This example will allow you to adjust the width of the datepicker field in a form. You can add this to your Formidable → Global Settings → Custom CSS page.

.ui-datepicker{
max-width:20em !important;
}
Was this article helpful? *

This article may contain affiliate links. Once in a while, we earn commissions from those links. But we only recommend products we like, with or without commissions.

In this article

    We have a small, but amazing team of dedicated people who are committed to helping you achieve your goals and project requirements.


    Copyright © 2025 Strategy11, LLC. Formidable Forms® is a registered trademark Strategy11, LLC.

    Join 400,000+ using Formidable Forms to create form-focused solutions fast. Get Formidable Forms