<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Gravity Support Forums Topic: Start Date / End Date - calculate # of days - HOW?</title>
		<link>https://legacy.forums.gravityhelp.com/topic/start-date-end-date-calculate-of-days-how</link>
		<description>Gravity Support Forums Topic: Start Date / End Date - calculate # of days - HOW?</description>
		<language>en-US</language>
		<pubDate>Mon, 20 Apr 2026 03:05:40 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>https://legacy.forums.gravityhelp.com/search.php</link>
		</textInput>
		<atom:link href="https://legacy.forums.gravityhelp.com/rss/topic/start-date-end-date-calculate-of-days-how" rel="self" type="application/rss+xml" />

		<item>
			<title>studio57designs on "Start Date / End Date - calculate # of days - HOW?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/start-date-end-date-calculate-of-days-how#post-57110</link>
			<pubDate>Tue, 01 May 2012 05:50:58 +0000</pubDate>
			<dc:creator>studio57designs</dc:creator>
			<guid isPermaLink="false">57110@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Thank you Alex.  I gave it a try, but did not work for me.  It was passing a value of 1 instead of the actual # of days.&#60;/p&#62;
&#60;p&#62;I'll check with Cart66....but, I really appreciate the response.  Gives me some place to start.&#60;/p&#62;
&#60;p&#62;Louise
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Alex Cancado on "Start Date / End Date - calculate # of days - HOW?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/start-date-end-date-calculate-of-days-how#post-57054</link>
			<pubDate>Mon, 30 Apr 2012 16:59:34 +0000</pubDate>
			<dc:creator>Alex Cancado</dc:creator>
			<guid isPermaLink="false">57054@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hello Louise,&#60;br /&#62;
I am not familiar with the details on how Cart66 integrates with Gravity Forms, so I can't give you a complete code snippet. However, you can use one of our hooks to calculate the number of days between two dates, come up with a total price based on a daily rate and finally store that result into another Gravity Forms field. Hopefully this will help you achieve your goal. If you still aren't able to make this work, I would suggest reaching out to the Cart66 folks. as they are the ones who built the integration with Gravity Forms and should be more familiar with it.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_action(&#38;quot;gform_pre_submission&#38;quot;, &#38;quot;pre_submission_handler&#38;quot;);
function pre_submission_handler($form){

    $start_date = $_POST[&#38;quot;input_2&#38;quot;]; //NOTE: replace 2 with your actual start date input ID
    $end_date = $_POST[&#38;quot;input_3&#38;quot;];  //NOTE: replace 3 with your actual end date input ID
    $days = gf_date_diff($start_date, $end_date);

    $daily_rate = 6.00;

    $_POST[&#38;quot;input_4&#38;quot;] = floatval($daily_rate) * floatval($days); //NOTE: replace 4 with your actual total field ID (field that will be passed to Cart66)
}

function gf_date_diff($start, $end) {
    $start_ts = strtotime($start);
    $end_ts = strtotime($end);
    $diff = $end_ts - $start_ts;
    return round($diff / 86400);
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Cheers,&#60;br /&#62;
Alex
&#60;/p&#62;</description>
		</item>
		<item>
			<title>studio57designs on "Start Date / End Date - calculate # of days - HOW?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/start-date-end-date-calculate-of-days-how#post-57051</link>
			<pubDate>Mon, 30 Apr 2012 16:48:22 +0000</pubDate>
			<dc:creator>studio57designs</dc:creator>
			<guid isPermaLink="false">57051@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Ok, thanks so much!  I'll wait to hear from your guys.&#60;/p&#62;
&#60;p&#62;Louise
&#60;/p&#62;</description>
		</item>
		<item>
			<title>David Peralty on "Start Date / End Date - calculate # of days - HOW?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/start-date-end-date-calculate-of-days-how#post-57048</link>
			<pubDate>Mon, 30 Apr 2012 16:42:39 +0000</pubDate>
			<dc:creator>David Peralty</dc:creator>
			<guid isPermaLink="false">57048@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I just wanted to let you know that I've asked one of the developers to take a look at this post to see if they can give you any guidance. We aren't ignoring you. :)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>studio57designs on "Start Date / End Date - calculate # of days - HOW?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/start-date-end-date-calculate-of-days-how#post-56990</link>
			<pubDate>Mon, 30 Apr 2012 12:20:21 +0000</pubDate>
			<dc:creator>studio57designs</dc:creator>
			<guid isPermaLink="false">56990@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Is this even possible?  Anyone?&#60;/p&#62;
&#60;p&#62;Louise
&#60;/p&#62;</description>
		</item>
		<item>
			<title>studio57designs on "Start Date / End Date - calculate # of days - HOW?"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/start-date-end-date-calculate-of-days-how#post-56887</link>
			<pubDate>Sat, 28 Apr 2012 11:32:30 +0000</pubDate>
			<dc:creator>studio57designs</dc:creator>
			<guid isPermaLink="false">56887@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I have a rental form in Cart66 that has a start date and an end date.  Is it possible to enter both start and end date and then calculate the # of days?&#60;/p&#62;
&#60;p&#62;For example, the customer enters the start date of 5/1/2012 and end date of 5/6/2012 and the daily rate is $6.00 - we'd like to see the form pass the amount as $30 (5 days x $6) to the cart.&#60;/p&#62;
&#60;p&#62;Is there a way to create a function to do that or is it already built in and I've just not found it?&#60;/p&#62;
&#60;p&#62;Thanks,&#60;/p&#62;
&#60;p&#62;Louise
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
