<?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: Date Calculations</title><link>https://www.infopathdev.com:443/forums/thread/51355.aspx</link><pubDate>Wed, 03 Feb 2010 14:45:36 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:51355</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/51355.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=51355</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Sorry Alec, I didn&amp;#39;t realize that.&amp;nbsp; I&amp;#39;ve edited my post to use your link instead of the other one.&amp;nbsp; Feel free to edit your post as well.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Date Calculations</title><link>https://www.infopathdev.com:443/forums/thread/51353.aspx</link><pubDate>Wed, 03 Feb 2010 13:46:40 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:51353</guid><dc:creator>Alec Pojidaev</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/51353.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=51353</wfw:commentRss><description>&lt;p&gt;Thanks Jimmy.&lt;/p&gt;</description></item><item><title>Re: Date Calculations</title><link>https://www.infopathdev.com:443/forums/thread/51335.aspx</link><pubDate>Wed, 03 Feb 2010 00:08:10 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:51335</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/51335.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=51335</wfw:commentRss><description>&lt;p&gt;It&amp;#39;s possible to get a date difference without using code:&lt;/p&gt;&lt;p&gt;[originally posted link deleted] &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;a 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;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Date Calculations</title><link>https://www.infopathdev.com:443/forums/thread/51324.aspx</link><pubDate>Tue, 02 Feb 2010 21:22:20 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:51324</guid><dc:creator>Matthew1970</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/51324.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=51324</wfw:commentRss><description>&lt;p&gt;Why is it that MS never seems to include their standard database functions in new products like info path? DateDiff is a a function that has been around since the earliest launches of MS Access. This should be a standard item listed in the functions for a field in Info Path. There are many other examples of functions they have left out of infopath, forcing you to go and start learning .NET code when you may just be a power user who certainly can develop forms until MS forces you to code. Ridiculous....&lt;/p&gt;</description></item><item><title>Re: Date Calculations</title><link>https://www.infopathdev.com:443/forums/thread/25614.aspx</link><pubDate>Sat, 12 Jan 2008 04:46:12 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:25614</guid><dc:creator>barmatt80</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/25614.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=25614</wfw:commentRss><description>&lt;p&gt;I know this is an old post, but I have seen quite some questions on date calculations and posts to the msdn site, which I looked through and really didn&amp;#39;t help me much.&amp;nbsp; So I came up with this, hopefully new people will find it helpful.&amp;nbsp; Simply takes the&amp;nbsp; difference between two date picker boxes in infopath(2003 or 2007).&amp;nbsp; Also it was about time I posted some useful information to this great site.&lt;/p&gt;
&lt;p&gt;My two date fields were: StartDate and EndDate, and the difference was saved in DaysOff text box.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;I also used an on after event for end date.&lt;/p&gt;
&lt;p&gt;VB.net Code (backward compatible with InfoPath 2003): &lt;/p&gt;&lt;font color="#0000ff" size="2"&gt;
&lt;p&gt;Imports&lt;/font&gt;&lt;font size="2"&gt; Microsoft.VisualBasic.DateAndTime (reference that at the top of the code under: &lt;font color="#0000ff" size="2"&gt;Imports&lt;/font&gt;&lt;font size="2"&gt; Microsoft.Office.Interop.InfoPath.SemiTrust)&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;font size="2"&gt;&lt;font size="2"&gt;&lt;font color="#008000" size="2"&gt;
&lt;p&gt;&amp;#39;If StartDate and EndDate is not blank, and End Date is greater than StartDate then calculate difference.&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;If&lt;/font&gt;&lt;font size="2"&gt; thisXDocument.DOM.selectSingleNode(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;/dfs:myFields/my:AbsenceDetails/my:StartDate&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;).text &amp;lt;&amp;gt; &lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;&amp;quot;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;And&lt;/font&gt;&lt;font size="2"&gt; _&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;thisXDocument.DOM.selectSingleNode(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;/dfs:myFields/my:AbsenceDetails/my:EndDate&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;).text &amp;lt;&amp;gt; &lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;&amp;quot;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;And&lt;/font&gt;&lt;font size="2"&gt; _&lt;/p&gt;System.Convert.ToString(thisXDocument.DOM.selectSingleNode(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;/dfs:myFields/my:AbsenceDetails/my:EndDate&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;).text) &amp;gt; _&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;System.Convert.ToString(thisXDocument.DOM.selectSingleNode(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;/dfs:myFields/my:AbsenceDetails/my:StartDate&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;).text) &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Then&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&amp;#39;Calculates the difference between StartDate and EndDate.&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Dim&lt;/font&gt;&lt;font size="2"&gt; datStart &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Date&lt;/font&gt;&lt;font size="2"&gt; = thisXDocument.DOM.selectSingleNode(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;/dfs:myFields/my:AbsenceDetails/my:StartDate&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;).text&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Dim&lt;/font&gt;&lt;font size="2"&gt; datEnd &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Date&lt;/font&gt;&lt;font size="2"&gt; = thisXDocument.DOM.selectSingleNode(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;/dfs:myFields/my:AbsenceDetails/my:EndDate&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;).text&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&amp;#39;Add one day to correct the calculation.&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Dim&lt;/font&gt;&lt;font size="2"&gt; strDaysOff &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;String&lt;/font&gt;&lt;font size="2"&gt; = (DateDiff(Microsoft.VisualBasic.DateInterval.Day, datStart, datEnd) + 1)&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&amp;#39;Assigns the result to DaysOff&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;thisXDocument.DOM.selectSingleNode(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;/dfs:myFields/my:DaysOff&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;).text = strDaysOff&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;Else&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;thisXDocument.DOM.selectSingleNode(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;/dfs:myFields/my:DaysOff&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;).text = &lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;&amp;quot;&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;End&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;If&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;&amp;nbsp;&lt;font color="#000000"&gt;I know the code is rudamentary, and probably violated some code, or the code could be trimmed down, but it works, and hopefully others will find it usefull. &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#000000"&gt;Also should be noted the +1 was added to the date difference because in my case I needed to know the number of days between the two dates(start and end date).&amp;nbsp; For example For a work week that is monday through friday, using the code above would net a result of 5, because the time span is 5 days, however if you don&amp;#39;t put +1 on there then it would be 4 as friday is 4 days after monday.&amp;nbsp; I also would put a rule in infopath to pop a message up if the end date is before the first date, and then zero the box making the user reselect a date later than the start date.&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;</description></item><item><title>Re: Date Calculations</title><link>https://www.infopathdev.com:443/forums/thread/18367.aspx</link><pubDate>Mon, 31 Oct 2005 14:29:21 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:18367</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/18367.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=18367</wfw:commentRss><description>Working with date calculations in most programming languages is usually a pain... Maybe we should change the world's calendar to better suit our needs.&lt;br /&gt;&lt;br /&gt;---------------&lt;br /&gt;Matt Faus&lt;br /&gt;</description></item><item><title>Re: Date Calculations</title><link>https://www.infopathdev.com:443/forums/thread/18366.aspx</link><pubDate>Sat, 29 Oct 2005 05:36:46 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:18366</guid><dc:creator>Patrick Halstead</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/18366.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=18366</wfw:commentRss><description>Tatopitta: the code will work regardless of the regional setting. &lt;br /&gt;199840: if you are more familiar with JScript, I recommend you use that.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Patrick Halstead [InfoPath MVP]&lt;br /&gt;InfoPathDev</description></item><item><title>Re: Date Calculations</title><link>https://www.infopathdev.com:443/forums/thread/18365.aspx</link><pubDate>Wed, 26 Oct 2005 10:29:48 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:18365</guid><dc:creator>199840</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/18365.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=18365</wfw:commentRss><description>I have seen that link, however it was a litte complicated, im struggling to know which language to write in, when using managed code in InfoPath, my default setting appears to be Jscript. &lt;br /&gt;I only really need to know the difference between the two dates in days. eg, difference between 1st nov 2005 and 2nd Nov 2005 is 1 day.&lt;br /&gt;Any ideas????</description></item><item><title>Re: Date Calculations</title><link>https://www.infopathdev.com:443/forums/thread/18364.aspx</link><pubDate>Wed, 26 Oct 2005 06:24:06 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:18364</guid><dc:creator>tatopitta</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/18364.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=18364</wfw:commentRss><description>Hi, just another question about it: does the date management change in relation to the regional setting of the machine? For example when you select a part of a date by code?</description></item><item><title>Re: Date Calculations</title><link>https://www.infopathdev.com:443/forums/thread/18363.aspx</link><pubDate>Wed, 26 Oct 2005 04:58:03 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:18363</guid><dc:creator>franck</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/18363.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=18363</wfw:commentRss><description>Hi,&lt;br /&gt;&lt;br /&gt;Here is a good reference for this:&lt;br /&lt;a target="_blank" href=http://blogs.msdn.com/infopath/archive/2005/01/25/360318.aspx&gt;http://blogs.msdn.com/infopath/archive/2005/01/25/360318.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;&lt;br /&gt;Franck Dauché</description></item><item><title>Re: Date Calculations</title><link>https://www.infopathdev.com:443/forums/thread/18362.aspx</link><pubDate>Tue, 25 Oct 2005 19:08:23 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:18362</guid><dc:creator>Patrick Halstead</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/18362.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=18362</wfw:commentRss><description>Hi 199840 and welcome to our forum,&lt;br /&gt;Do you want the units in years, months, days, hours, minutes, seconds, or milliseconds? You'll likely have to write some code to subtract each of the major units and convert. Should be pretty simple though. Have you searched for other threads on date calculations?&lt;br /&gt;&lt;br /&gt;Patrick Halstead [InfoPath MVP]&lt;br /&gt;InfoPathDev</description></item><item><title>Date Calculations</title><link>https://www.infopathdev.com:443/forums/thread/18314.aspx</link><pubDate>Tue, 25 Oct 2005 08:35:04 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:18314</guid><dc:creator>199840</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/18314.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=18314</wfw:commentRss><description>I hope this is simple, two date pickers i just want to find the difference between the two date out putted in a text field.&lt;br /&gt;&lt;br /&gt;Please help</description></item></channel></rss>