<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>General</title><link>https://www.infopathdev.com:443/forums/41.aspx</link><description>If you're not sure where to ask your question, ask it here. If necessary, our moderators will make sure it gets classified in the correct board.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Help please-Solve:  Number of days = (todays date - date initiated) ????</title><link>https://www.infopathdev.com:443/forums/thread/125314.aspx</link><pubDate>Thu, 20 Apr 2023 23:36:05 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:125314</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/125314.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=125314</wfw:commentRss><description>See attached. You had an error in the conditions on one of your fields - you&amp;#39;d typed in xdXDate instead of xdDate. This condition error was preventing the rules from stopping correctly.</description></item><item><title>Re: Help please-Solve:  Number of days = (todays date - date initiated) ????</title><link>https://www.infopathdev.com:443/forums/thread/125313.aspx</link><pubDate>Thu, 20 Apr 2023 15:45:52 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:125313</guid><dc:creator>yourluckycharm</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/125313.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=125313</wfw:commentRss><description>Hi Hilary, 

Here&amp;#39;s the form that i made for the calculation.</description></item><item><title>Re: Help please-Solve:  Number of days = (todays date - date initiated) ????</title><link>https://www.infopathdev.com:443/forums/thread/125310.aspx</link><pubDate>Thu, 20 Apr 2023 14:35:57 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:125310</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/125310.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=125310</wfw:commentRss><description>I&amp;#39;d need to see your form to find the issue. You can attach it under a reply on the Options tab.</description></item><item><title>Re: Help please-Solve:  Number of days = (todays date - date initiated) ????</title><link>https://www.infopathdev.com:443/forums/thread/125309.aspx</link><pubDate>Thu, 20 Apr 2023 12:57:19 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:125309</guid><dc:creator>yourluckycharm</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/125309.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=125309</wfw:commentRss><description>Hi Hilary, 

Thank you so much for your reply and help. 
i already implemented all of the rules and xml file. but every time i try to do preview, it got error like this :

Some rules were not applied 
with details : 
An error occured in the form&amp;#39;s rules or code. The number of rules actions or the number of calls to the OnAfterChange event for single update in the data exceeded the maximum limit. 
The rules or code may be causing an infinite loop. To prevent this, ensure that the rule action or even handler does not update the data which causes the same rule action or even handler to execute. 



i already try to make a new form at it still got error like this one, i&amp;#39;m using infoPath 2013. Really looking forward for your reply. 



Thanks!</description></item><item><title>Re: Help please-Solve:  Number of days = (todays date - date initiated) ????</title><link>https://www.infopathdev.com:443/forums/thread/125304.aspx</link><pubDate>Wed, 19 Apr 2023 14:04:26 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:125304</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/125304.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=125304</wfw:commentRss><description>&lt;p&gt;You can find an outline of logic for this here: &lt;a href="https://social.msdn.microsoft.com/Forums/en-US/b72c47ad-4f83-49db-8372-3e336c2e1cde/infopath-rule-for-calculating-business-days?forum=sharepointcustomizationlegacy"&gt;https://social.msdn.microsoft.com/Forums/en-US/b72c47ad-4f83-49db-8372-3e336c2e1cde/infopath-rule-for-calculating-business-days?forum=sharepointcustomizationlegacy&lt;/a&gt; and I am also attaching a sample form with this logic implemented that came from this post: &lt;a href="https://www.infopathdev.com/forums/p/40463/125295.aspx#125295"&gt;https://www.infopathdev.com/forums/p/40463/125295.aspx#125295&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;To take a look at the sample form, right click the link in the post header and save the file locally. Right click the saved file and select Design to open in design mode. The logic in that form is in the repeating table.&lt;/p&gt;</description></item><item><title>Re: Help please-Solve:  Number of days = (todays date - date initiated) ????</title><link>https://www.infopathdev.com:443/forums/thread/125303.aspx</link><pubDate>Wed, 19 Apr 2023 10:49:41 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:125303</guid><dc:creator>yourluckycharm</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/125303.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=125303</wfw:commentRss><description>Hi are you guys have any ideas from this source for calculating 5 bussiness day? 

thanks for your help :)</description></item><item><title>Re: Help please-Solve:  Number of days = (todays date - date initiated) ????</title><link>https://www.infopathdev.com:443/forums/thread/119535.aspx</link><pubDate>Mon, 30 Jul 2018 14:57:17 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:119535</guid><dc:creator>Travisty2520</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/119535.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=119535</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hello,&lt;/p&gt;&lt;p&gt;&amp;nbsp;I am using two Date/Time fields to mark the start and end of a brake in out IT. I want the rules formulae to work out the difference between them as a mean time to repair for reporting currently using an spreadsheet but feel this is more progressive and can then add in other functions off this.&lt;/p&gt;</description></item><item><title>Re: Help please-Solve:  Number of days = (todays date - date initiated) ????</title><link>https://www.infopathdev.com:443/forums/thread/119150.aspx</link><pubDate>Thu, 31 May 2018 17:29:03 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:119150</guid><dc:creator>InfoPathinator</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/119150.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=119150</wfw:commentRss><description>&lt;p&gt;I utilize a separate SharePoint list to help calculate the number of days between two dates in Infopath. This is so I can account for leap years and have the ability to just count work days, not all days. I update this list with new data once a year.&lt;br /&gt;&lt;br /&gt;Here is the Excel file source for the list containing 2018-2020 data: &lt;a target="_blank" href="https://1drv.ms/x/s!ApLhBloaS1wVgsUOMRrRfbekFftY9Q"&gt;https://1drv.ms/x/s!ApLhBloaS1wVgsUOMRrRfbekFftY9Q&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Steps: &lt;/b&gt;&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;Import the first worksheet of the above Excel file as a new list in SharePoint.&lt;/li&gt;&lt;li&gt;Add a receive data connection to this list from your InfoPath form.&lt;/li&gt;&lt;li&gt;For the first date, create a action to convert the date to a number in YYYYMMDD format. Assuming the date is stored as DateTime, you can use this formula:&amp;nbsp; floor(number(translate(substring-before(../my:endDate, &amp;quot;T&amp;quot;), &amp;quot;-&amp;quot;, &amp;quot;&amp;quot;)))&lt;/li&gt;&lt;li&gt;Query the list for the number value of the first date. Store this number in a field (column) in your form. (This field does not need to show in your form.)&lt;/li&gt;&lt;li&gt;Repeat steps 3 &amp;amp; 4for the second date.&lt;/li&gt;&lt;li&gt;Subtract the first date number from the 2nd, store this in a third column.&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;Note: The Excel file uses the formula &amp;quot;NETWORKDAYS&amp;quot; and includes columns for weekdays, weekdays minus US Federal holidays, and weekdays minus NYSE holidays. Now you can get the number of work days between two dates using one of these columns. If you live outside the US, you could add a column to the Excel for other holidays, such as UK bank holidays.&lt;/p&gt;</description></item><item><title>Re: Help please-Solve:  Number of days = (todays date - date initiated) ????</title><link>https://www.infopathdev.com:443/forums/thread/103611.aspx</link><pubDate>Fri, 14 Aug 2015 14:21:48 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:103611</guid><dc:creator>Paul-Emile</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/103611.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=103611</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hi, &lt;/p&gt;&lt;p&gt;This code is working well until I pick dates that are in two different months. When I pick start date = 2015-08-01 and end date = 2015-09-05, it tells me that there are 4 days separating these dates while in fact there are 34. Any suggestions as how to fix this problem?&lt;/p&gt;&lt;p&gt;Thanks&lt;/p&gt;</description></item><item><title>Re: Help please-Solve:  Number of days = (todays date - date initiated) ????</title><link>https://www.infopathdev.com:443/forums/thread/103219.aspx</link><pubDate>Mon, 13 Jul 2015 01:52:38 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:103219</guid><dc:creator>Michael Campbell</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/103219.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=103219</wfw:commentRss><description>Thanks you. I am not a coder and this works perfrectly for me!!!</description></item><item><title>Re: Help please-Solve:  Number of days = (todays date - date initiated) ????</title><link>https://www.infopathdev.com:443/forums/thread/96977.aspx</link><pubDate>Fri, 11 Apr 2014 07:12:44 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:96977</guid><dc:creator>magdalena.deleva</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/96977.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=96977</wfw:commentRss><description>&lt;p&gt; 
Hi, when using this formula to calculate difference between dates, example 01/03/2013 to 03/03/2014 formula calculates 2 days, acctually difference is + days.&lt;/p&gt;&lt;p&gt;Can you please advice where add +1 day in the formula or to change the logic of calculation?&lt;/p&gt;&lt;p&gt;Thank you&lt;/p&gt;</description></item><item><title>Re: Help please-Solve:  Number of days = (todays date - date initiated) ????</title><link>https://www.infopathdev.com:443/forums/thread/96687.aspx</link><pubDate>Wed, 26 Mar 2014 20:44:16 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:96687</guid><dc:creator>Judyy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/96687.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=96687</wfw:commentRss><description>Will this solution work for InfoPath 2010? I have tried it with no luck :(&lt;br /&gt;</description></item><item><title>Re: Help please-Solve:  Number of days = (todays date - date initiated) ????</title><link>https://www.infopathdev.com:443/forums/thread/93141.aspx</link><pubDate>Wed, 18 Sep 2013 20:29:34 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:93141</guid><dc:creator>jweller</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/93141.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=93141</wfw:commentRss><description>&lt;p&gt;This works great, but how can one remove Saturday&amp;#39;s and Sunday&amp;#39;s from the calculations?&amp;nbsp; Also, are there any tricks to including bank calendar holidays?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Jason &lt;/p&gt;</description></item><item><title>Re: Help please-Solve:  Number of days = (todays date - date initiated) ????</title><link>https://www.infopathdev.com:443/forums/thread/87614.aspx</link><pubDate>Sun, 03 Mar 2013 22:36:56 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:87614</guid><dc:creator>sengigi</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/87614.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=87614</wfw:commentRss><description>&lt;p&gt;I have got a different scenario - I would like to point everything to 31/12/&amp;lt;year+1&amp;gt;. Example: if I select 03/04/2013, I would like the next date to return 31/12/2014. &lt;/p&gt;&lt;p&gt;Any kind souls like to throw in suggestion &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Help please-Solve:  Number of days = (todays date - date initiated) ????</title><link>https://www.infopathdev.com:443/forums/thread/80458.aspx</link><pubDate>Wed, 11 Jul 2012 19:41:47 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:80458</guid><dc:creator>earlkmi</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/80458.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=80458</wfw:commentRss><description>&lt;p&gt;Appreciate your help&lt;/p&gt;
&lt;p&gt;I was able to find a product that I used to resolve the &amp;quot;delta&amp;quot; = the difference between dates.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;The link is listed:&amp;nbsp; &lt;a href="http://www.bizsupportonline.net/infopath2007/calculate-date-difference-infopath-rules-formulas.htm"&gt;http://www.bizsupportonline.net/infopath2007/calculate-date-difference-infopath-rules-formulas.htm&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;strong&gt;Calculate the difference between two date picker controls in InfoPath using rules and formulas - no code!&lt;/strong&gt;&lt;/p&gt;
&lt;div id="author"&gt;
&lt;p&gt;by &lt;a href="http://www.bizsupportonline.net/about-sym-wong-a-ton-infopath.htm"&gt;S.Y.M. Wong-A-Ton&lt;/a&gt; | Applies to: &lt;a href="http://www.bizsupportonline.net/infopath2007/index.htm"&gt;InfoPath 2007&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
&lt;p class="description"&gt;Use rules, conditions, and the number(), floor(), and substring() functions in formulas to calculate the difference between two date picker controls in InfoPath.&lt;/p&gt;
&lt;p class="description"&gt;Use rules, conditions, and the number(), floor(), and substring() functions in formulas to calculate the difference between two date picker controls in InfoPath.&lt;/p&gt;
&lt;div style="PADDING-BOTTOM:0px;PADDING-LEFT:5px;PADDING-RIGHT:0px;FLOAT:right;PADDING-TOP:0px;" class="ad"&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/div&gt;
&lt;h2&gt;Problem&lt;/h2&gt;
&lt;p&gt;You have a form template with two &lt;a href="http://www.bizsupportonline.net/infopath-date-picker.htm"&gt;InfoPath date picker&lt;/a&gt; controls and you would like to calculate the difference between the two date picker controls without writing code.&lt;/p&gt;
&lt;h2&gt;Solution&lt;/h2&gt;
&lt;p&gt;Use rules, conditions, and the &lt;strong&gt;number()&lt;/strong&gt;, &lt;strong&gt;floor()&lt;/strong&gt;, and &lt;strong&gt;substring()&lt;/strong&gt; functions in formulas to calculate the difference between two date picker controls in InfoPath. &lt;/p&gt;
&lt;h2&gt;Discussion&lt;/h2&gt;
&lt;p&gt;You can accomplish this functionality as follows:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Design an InfoPath form template as shown in figure 1 with two &lt;strong&gt;Date Picker&lt;/strong&gt; controls named &lt;strong&gt;startDate&lt;/strong&gt; and &lt;strong&gt;endDate&lt;/strong&gt;, and one &lt;strong&gt;Text Box&lt;/strong&gt; control named &lt;strong&gt;difference&lt;/strong&gt;. &lt;br /&gt;&lt;img border="0" src="http://www.bizsupportonline.net/infopath2007/articles/images/200710272044.png" width="300" height="146" alt="" /&gt; &lt;br /&gt;&lt;font size="2"&gt;&lt;strong&gt;Figure 1. InfoPath form template in Design mode.&lt;/strong&gt; &lt;br /&gt;&lt;br /&gt;The Main data source of the InfoPath form template should resemble the following figure: &lt;br /&gt;&lt;br /&gt;&lt;img border="0" src="http://www.bizsupportonline.net/infopath2007/articles/images/200710272045.png" width="125" height="119" alt="" /&gt; &lt;br /&gt;&lt;strong&gt;Figure 2. The Main data source of the InfoPath form template.&lt;/strong&gt; &lt;/font&gt;&lt;/li&gt;
&lt;li&gt;Add the following &lt;strong&gt;Rule&lt;/strong&gt; to the &lt;strong&gt;startDate&lt;/strong&gt; field: &lt;br /&gt;Action: &lt;em&gt;Set a field&amp;#39;s value&lt;/em&gt; &lt;br /&gt;Field: &lt;em&gt;difference&lt;/em&gt; &lt;br /&gt;Value: 
&lt;div class="codecontainer"&gt;&lt;code&gt;(number(substring(../my:endDate, 9, 2)) + floor((153 * (number(substring(../my:endDate, 6, 2)) + 12 * (floor((14 - number(substring(../my:endDate, 6, 2))) div 12)) - 3) + 2) div 5) + (number(substring(../my:endDate, 1, 4)) + 4800 - (floor((14 - number(substring(../my:endDate, 6, 2))) div 12))) * 365 + floor((number(substring(../my:endDate, 1, 4)) + 4800 - (floor((14 - number(substring(../my:endDate, 6, 2))) div 12))) div 4) - floor((number(substring(../my:endDate, 1, 4)) + 4800 - (floor((14 - number(substring(../my:endDate, 6, 2))) div 12))) div 100) + floor((number(substring(../my:endDate, 1, 4)) + 4800 - (floor((14 - number(substring(../my:endDate, 6, 2))) div 12))) div 400) - 32045) - (number(substring(., 9, 2)) + floor((153 * (number(substring(., 6, 2)) + 12 * (floor((14 - number(substring(., 6, 2))) div 12)) - 3) + 2) div 5) + (number(substring(., 1, 4)) + 4800 - (floor((14 - number(substring(., 6, 2))) div 12))) * 365 + floor((number(substring(., 1, 4)) + 4800 - (floor((14 - number(substring(., 6, 2))) div 12))) div 4) - floor((number(substring(., 1, 4)) + 4800 - (floor((14 - number(substring(., 6, 2))) div 12))) div 100) + floor((number(substring(., 1, 4)) + 4800 - (floor((14 - number(substring(., 6, 2))) div 12))) div 400) - 32045) &lt;/code&gt;&lt;/div&gt;with the following &lt;strong&gt;Conditions&lt;/strong&gt; on the &lt;strong&gt;Rule&lt;/strong&gt;: &lt;br /&gt;&lt;em&gt;startDate is not blank&lt;/em&gt; &lt;strong&gt;and&lt;/strong&gt; &lt;br /&gt;&lt;em&gt;endDate is not blank&lt;/em&gt; &lt;/li&gt;
&lt;li&gt;Add a second &lt;strong&gt;Rule&lt;/strong&gt; to the &lt;strong&gt;startDate&lt;/strong&gt; field with the following settings: &lt;br /&gt;Action: &lt;em&gt;Set a field&amp;#39;s value&lt;/em&gt; &lt;br /&gt;Field: &lt;em&gt;difference&lt;/em&gt; &lt;br /&gt;Value: &lt;em&gt;0&lt;/em&gt; &lt;br /&gt;&lt;br /&gt;with the following &lt;strong&gt;Conditions&lt;/strong&gt; on the &lt;strong&gt;Rule&lt;/strong&gt;: &lt;br /&gt;&lt;em&gt;startDate is blank&lt;/em&gt; &lt;strong&gt;or&lt;/strong&gt; &lt;br /&gt;&lt;em&gt;endDate is blank&lt;/em&gt; &lt;/li&gt;
&lt;li&gt;Add the following &lt;strong&gt;Rule&lt;/strong&gt; to the &lt;strong&gt;endDate&lt;/strong&gt; field: &lt;br /&gt;Action: &lt;em&gt;Set a field&amp;#39;s value&lt;/em&gt; &lt;br /&gt;Field: &lt;em&gt;difference&lt;/em&gt; &lt;br /&gt;Value: 
&lt;div class="codecontainer"&gt;&lt;code&gt;(number(substring(., 9, 2)) + floor((153 * (number(substring(., 6, 2)) + 12 * (floor((14 - number(substring(., 6, 2))) div 12)) - 3) + 2) div 5) + (number(substring(., 1, 4)) + 4800 - (floor((14 - number(substring(., 6, 2))) div 12))) * 365 + floor((number(substring(., 1, 4)) + 4800 - (floor((14 - number(substring(., 6, 2))) div 12))) div 4) - floor((number(substring(., 1, 4)) + 4800 - (floor((14 - number(substring(., 6, 2))) div 12))) div 100) + floor((number(substring(., 1, 4)) + 4800 - (floor((14 - number(substring(., 6, 2))) div 12))) div 400) - 32045) - (number(substring(../my:startDate, 9, 2)) + floor((153 * (number(substring(../my:startDate, 6, 2)) + 12 * (floor((14 - number(substring(../my:startDate, 6, 2))) div 12)) - 3) + 2) div 5) + (number(substring(../my:startDate, 1, 4)) + 4800 - (floor((14 - number(substring(../my:startDate, 6, 2))) div 12))) * 365 + floor((number(substring(../my:startDate, 1, 4)) + 4800 - (floor((14 - number(substring(../my:startDate, 6, 2))) div 12))) div 4) - floor((number(substring(../my:startDate, 1, 4)) + 4800 - (floor((14 - number(substring(../my:startDate, 6, 2))) div 12))) div 100) + floor((number(substring(../my:startDate, 1, 4)) + 4800 - (floor((14 - number(substring(../my:startDate, 6, 2))) div 12))) div 400) - 32045) &lt;/code&gt;&lt;/div&gt;with the following &lt;strong&gt;Conditions&lt;/strong&gt; on the &lt;strong&gt;Rule&lt;/strong&gt;: &lt;br /&gt;&lt;em&gt;startDate is not blank&lt;/em&gt; &lt;strong&gt;and&lt;/strong&gt; &lt;br /&gt;&lt;em&gt;endDate is not blank&lt;/em&gt; &lt;/li&gt;
&lt;li&gt;Add a second &lt;strong&gt;Rule&lt;/strong&gt; to the &lt;strong&gt;endDate&lt;/strong&gt; field with the following settings: &lt;br /&gt;Action: &lt;em&gt;Set a field&amp;#39;s value&lt;/em&gt; &lt;br /&gt;Field: &lt;em&gt;difference&lt;/em&gt; &lt;br /&gt;Value: &lt;em&gt;0&lt;/em&gt; &lt;br /&gt;&lt;br /&gt;with the following &lt;strong&gt;Conditions&lt;/strong&gt; on the &lt;strong&gt;Rule&lt;/strong&gt;: &lt;br /&gt;&lt;em&gt;startDate is blank&lt;/em&gt; &lt;strong&gt;or&lt;/strong&gt; &lt;br /&gt;&lt;em&gt;endDate is blank&lt;/em&gt; &lt;/li&gt;
&lt;li&gt;Add the following &lt;strong&gt;Rule&lt;/strong&gt; to the &lt;strong&gt;difference&lt;/strong&gt; field: &lt;br /&gt;Action: &lt;em&gt;Set a field&amp;#39;s value&lt;/em&gt; &lt;br /&gt;Field: &lt;em&gt;.&lt;/em&gt; &lt;br /&gt;Value: &lt;em&gt;0&lt;/em&gt; &lt;br /&gt;&lt;br /&gt;with the following &lt;strong&gt;Condition&lt;/strong&gt; on the &lt;strong&gt;Rule&lt;/strong&gt;: &lt;br /&gt;&lt;em&gt;difference does not match pattern Custom Pattern: -{0,1}\d+&lt;/em&gt; &lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;You should now have a fully functional InfoPath form that will calculate the difference between the dates soon after you have entered valid dates. This solution also works for InfoPath 2003 form templates and InfoPath 2007 browser-enabled form templates. &lt;/p&gt;</description></item></channel></rss>