Need to quickly calculate the days between dates on your WordPress website? Formidable Forms' datepicker plugin lets you create custom date calculators without code!
Approximate read time: 7 minutes
Whether you want to create a cost estimator for a vacation property or help expectant parents count down to their baby's due date, finding the number of days between two dates can really come in handy.
Here are just a few examples of how an online date calculator can add value to your website:
- ⏳ Deadline calculator
- 🎫 Event countdown
- Pregnancy calculator
- 📦 Shipping date calculator
- 🛫 Travel, booking, or rental price calculator
- 🌍 Visa calculator
But if you landed on this article, you probably already have a reason you want to know how many days there are between two dates. So, we'll get right down to business.
We'd love to hear how you plan to use this tool — reply to this post below to let us know!
How to calculate the number of days between dates
In this tutorial, we will make a simple calculator to estimate the cost of renting a bike for a certain duration. 🚲 Ready to get rolling? Let's go!
Step 1: Install and activate Formidable Forms Pro
To make a custom date calculator for your website, you first need Formidable Forms Pro on your WordPress site. If you don't have the plugin yet, click the button below to grab your license.
The date calculation feature is included in the Business plan and above.
All set? Super! Let's start creating our calculator!
Step 2: Create your date calculator form
From the WordPress dashboard, head on over to Formidable → Forms. Next, click the blue + Add New button to create a new form.
For today's step-by-step guide, we're going to make a basic calculator form from scratch instead. So let's select Create a blank form and click Create to open up the drag and drop form builder.
Now, let's drag two Date fields into our form along with a # Number field. We'll click on each field in the form to edit the field name, description, and layout.
For this example, why don't we make the first date field the bike pickup date and the second the date when the customer will return the bike?
That'll make it easy to calculate how many days are between the two dates.
Then, we can multiply by the daily rental rate.
Step 3: Add field calculations
Next, it's time to make our form do some math.
Click on the number field to pull up its field settings. in the example below, our number field is called "Duration of rental."
Under the Advanced section of the Field Options tab, insert the formula for your date calculation.
Since we only want to find the total number of days for the rental period, we subtract the Pickup date field (or start date) from the Drop off date field (aka end date).
Since we want to give visitors a price estimate for their bike rental, we'll add a few other form fields so they can pick the type of bike they want and then see the rental cost.
When you're happy with your form, click Save and then Preview to test your custom calculator!
Step 4: Publish your calculator
It's all downhill from here! 🚵
To publish your date calculator, open up the WordPress post or page where you want to display it. Then, just add the Formidable Forms block in the editor and select your calculator form from the dropdown menu that appears.
Way to go! You now have a way to calculate the difference between two dates on your site! 🙌
Here's how our bike rental calculator ended up:
Go beyond counting days, months, or years
Formidable's datepicker calculations can do a lot more than tell you how many days are between two dates.
You can also:
- Countdown to an event from the current date
- Add or subtract days from a chosen date
- Only count business days/exclude weekends
- Include the start or end day in your calculations
Want to use the current date in your calculator?
Nothing could be easier! Just click the date field in your form, then set the default value for that field to be the current date in the settings on the left side of the screen.
You could also set the field to "Read only" so it can't be modified or hide the field so visitors don't see it.
It may not make much sense for our bike rental form, but it's ideal for countdowns. ⏲️
For example, here's a wedding countdown we made to instantly show how many days away a future date is from today.
Add or subtract days from a chosen date
With Formidable Forms, you can quickly make a calculator to find the date a certain number of years, months, weeks, or days from a specific date.
Check out our tutorial on how to calculate the day from a date to instantly find a past or future date!
Include the last day in your calculations
Sometimes, when counting the number of days between two dates, you may want to include the first or last day. This is especially important if you're creating a visa calculator or a similar time calculator tool.
Luckily, it's really easy to do with Formidable. Simply add a "+1" to your formula.
And then, ta-da! Your calculator now includes these days.
Instantly find the number of days between two dates
Whether you're looking to streamline your event planning, simplify travel arrangements, or conquer complex time-based challenges, Formidable Forms can help you create a custom online date calculator for your WordPress website.
So what are you waiting for? Add value to your site and multiply your traffic by adding a date calculator now.
Try out our calculator and form maker plugin for yourself to see how simple it is. And if for some reason, you don't fall head over heels, we offer a 14-day money-back guarantee!