<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/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>Date Calculations in InfoPath</title><link>http://blogs.msdn.com/b/infopath/archive/2005/01/25/360318.aspx</link><description>The SP1 update of InfoPath 2003 added calculation support – the value of a node can be set to the result of an XPath expression. This makes it possible to avoid writing code (script or managed) in many InfoPath forms. Date calculations, however, still</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Date Calculations in InfoPath</title><link>http://blogs.msdn.com/b/infopath/archive/2005/01/25/360318.aspx#10212709</link><pubDate>Fri, 16 Sep 2011 23:24:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10212709</guid><dc:creator>Steve</dc:creator><description>&lt;p&gt;I have an infopath form with a begin date and an end date for reporting. &amp;nbsp;I want records if dates fall into this date range. &amp;nbsp;This comparison works flawlessly until I use a year end date of 12/31/2011. &amp;nbsp;InfoPath seems to get confused at year end for some reason and leaves this record out of the result set. &amp;nbsp;I am using conditional formatting to hide this record on the Infopath form if it does not meet that condition. &amp;nbsp;It&amp;#39;s a very simple comparison. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Is dateA &amp;gt;= dateB?&lt;/p&gt;
&lt;p&gt;If so, hide this record.&lt;/p&gt;
&lt;p&gt;Why does the last day of the year not get included in my results set? &amp;nbsp; &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10212709" width="1" height="1"&gt;</description></item><item><title>re: Date Calculations in InfoPath</title><link>http://blogs.msdn.com/b/infopath/archive/2005/01/25/360318.aspx#10151002</link><pubDate>Thu, 07 Apr 2011 15:38:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10151002</guid><dc:creator>Toby Hosterman - National Pain Institute</dc:creator><description>&lt;p&gt;I used text parsing to accomplish a datediff between two dates. &amp;nbsp;Here&amp;#39;s how I thought it through:&lt;/p&gt;
&lt;p&gt;starting with: &amp;nbsp;2011-04-07T09:43:04&lt;/p&gt;
&lt;p&gt;FullTime = substring-after(&amp;lt;dateTime&amp;gt;,&amp;quot;T&amp;quot;) = 09:43:04&lt;/p&gt;
&lt;p&gt;Hours = substring-before(FullTime,&amp;quot;:&amp;quot;) = 09&lt;/p&gt;
&lt;p&gt;MInutes = substring-before(substring-after(FullTime,&amp;quot;:&amp;quot;),&amp;quot;:&amp;quot;) = 43&lt;/p&gt;
&lt;p&gt;(Hours * 60) + Minutes= Allminutes&lt;/p&gt;
&lt;p&gt;Seconds = substring-after(substring-after(FullTime,&amp;quot;:&amp;quot;),&amp;quot;:&amp;quot;)&lt;/p&gt;
&lt;p&gt;(Allminutes * 60) + seconds = AllSeconds&lt;/p&gt;
&lt;p&gt;FinalMinutes = AllSeconds/60&lt;/p&gt;
&lt;p&gt;So, the final formula that I pasted into the InfoPath formula box is:&lt;/p&gt;
&lt;p&gt;round(((((((substring-before(substring-after(&amp;lt;dateTime&amp;gt;,&amp;quot;T&amp;quot;),&amp;quot;:&amp;quot;)) * 60) + (substring-before(substring-after(substring-after(&amp;lt;dateTime&amp;gt;,&amp;quot;T&amp;quot;),&amp;quot;:&amp;quot;),&amp;quot;:&amp;quot;))) * 60) + (substring-after(substring-after(substring-after(&amp;lt;dateTime&amp;gt;,&amp;quot;T&amp;quot;),&amp;quot;:&amp;quot;),&amp;quot;:&amp;quot;))) / 60) - ((((((substring-before(substring-after(&amp;lt;dateTime&amp;gt;,&amp;quot;T&amp;quot;),&amp;quot;:&amp;quot;)) * 60) + (substring-before(substring-after(substring-after(&amp;lt;dateTime&amp;gt;,&amp;quot;T&amp;quot;),&amp;quot;:&amp;quot;),&amp;quot;:&amp;quot;))) * 60) + (substring-after(substring-after(substring-after(&amp;lt;dateTime&amp;gt;,&amp;quot;T&amp;quot;),&amp;quot;:&amp;quot;),&amp;quot;:&amp;quot;))) / 60))&lt;/p&gt;
&lt;p&gt;The &amp;lt;DateTime&amp;gt; references before the - sign were replaced with a reference to the later dateTime field, and the &amp;lt;DateTime&amp;gt; references after the - sign were replaced with a reference to the earlier dateTime field.&lt;/p&gt;
&lt;p&gt;In my scenario, I used the form open date/time (populated in a separate field by a rule run on Form Open using the now() function) and I wanted a field to show how long between form open and when the user clicked a button on the page. &amp;nbsp;When the user clicked the button, a rule put now() into a separate field. &amp;nbsp;Then the formula above provided me with an integer of the number of minutes between opening the form and when the user clicked the button.&lt;/p&gt;
&lt;p&gt;Hope this helps someone down the line.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10151002" width="1" height="1"&gt;</description></item><item><title>re: Date Calculations in InfoPath</title><link>http://blogs.msdn.com/b/infopath/archive/2005/01/25/360318.aspx#10144061</link><pubDate>Mon, 21 Mar 2011 22:56:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10144061</guid><dc:creator>Mel Pama</dc:creator><description>&lt;p&gt;We&amp;#39;re still using InfoPath 2003. &amp;nbsp;Can you show me or point me to a link where this is done in javascript. &amp;nbsp;I&amp;#39;m not sure about the XDocument.SelectSingleNode or if it&amp;#39;s XDocument::SelectSingleNode.&lt;/p&gt;
&lt;p&gt;Please replyh to mel.pama@renesas.com&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10144061" width="1" height="1"&gt;</description></item><item><title>re: Date Calculations in InfoPath</title><link>http://blogs.msdn.com/b/infopath/archive/2005/01/25/360318.aspx#10133125</link><pubDate>Wed, 23 Feb 2011 16:22:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10133125</guid><dc:creator>OPT</dc:creator><description>&lt;p&gt;Are you kidding me!!!!!! Why did the &amp;quot;TEAM&amp;quot; take out the AddDAte function......PUT IT BACK...how stupid was that.......&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10133125" width="1" height="1"&gt;</description></item><item><title>Date Calculations | keyongtech</title><link>http://blogs.msdn.com/b/infopath/archive/2005/01/25/360318.aspx#9362884</link><pubDate>Thu, 22 Jan 2009 07:52:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9362884</guid><dc:creator>Date Calculations | keyongtech</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://www.keyongtech.com/1238824-date-calculations"&gt;http://www.keyongtech.com/1238824-date-calculations&lt;/a&gt;&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9362884" width="1" height="1"&gt;</description></item><item><title>Berechnung von Zeit | hilpers</title><link>http://blogs.msdn.com/b/infopath/archive/2005/01/25/360318.aspx#9347716</link><pubDate>Tue, 20 Jan 2009 18:07:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9347716</guid><dc:creator>Berechnung von Zeit | hilpers</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://www.hilpers.com/1085772-berechnung-von-zeit"&gt;http://www.hilpers.com/1085772-berechnung-von-zeit&lt;/a&gt;&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9347716" width="1" height="1"&gt;</description></item><item><title>re: Date Calculations in InfoPath</title><link>http://blogs.msdn.com/b/infopath/archive/2005/01/25/360318.aspx#9307845</link><pubDate>Mon, 12 Jan 2009 17:07:03 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9307845</guid><dc:creator>Elfoamerican</dc:creator><description>&lt;p&gt;It's posible to calculate date difference with rules only.&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://alecpojidaev.wordpress.com/2008/12/30/infopath-codeless-programming-walkthrough-2/"&gt;http://alecpojidaev.wordpress.com/2008/12/30/infopath-codeless-programming-walkthrough-2/&lt;/a&gt;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9307845" width="1" height="1"&gt;</description></item><item><title>the rasx() context  &amp;raquo; Blog Archive   &amp;raquo; SonghaySystem.com Articles Never Written</title><link>http://blogs.msdn.com/b/infopath/archive/2005/01/25/360318.aspx#2360370</link><pubDate>Tue, 01 May 2007 20:25:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2360370</guid><dc:creator>the rasx() context  » Blog Archive   » SonghaySystem.com Articles Never Written</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://www.kintespace.com/rasxlog/?p=621"&gt;http://www.kintespace.com/rasxlog/?p=621&lt;/a&gt;&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2360370" width="1" height="1"&gt;</description></item></channel></rss>