<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Manipulating Months Difference in LabVIEW</title>
    <link>https://forums.ni.com/t5/LabVIEW/Manipulating-Months-Difference/m-p/906665#M408564</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;nathand wrote: &lt;BR /&gt;I recently wrote and uploaded a VI to do something close in response to a similar question, see &lt;A href="http://forums.ni.com/ni/board/message?board.id=170&amp;amp;message.id=402365#M402365" target="_blank"&gt;here&lt;/A&gt;.&amp;nbsp; It will add any amount of time, not just months but should be quick to modify for subtraction (maybe you can just provide a negative number of months, I haven't tested that). &amp;nbsp; It hasn't been thoroughly tested but is simple enough that if there are bugs you should be able to resolve them easily. &lt;DIV class="message-edit-history"&gt;&lt;SPAN class="edit-author"&gt;Message Edited by nathand on &lt;/SPAN&gt;&lt;SPAN class="local-date"&gt;05-13-2009&lt;/SPAN&gt;&lt;SPAN class="local-time"&gt; 10:01 AM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have taken the liberty of linking the image of your suggested code below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="http://forums.ni.com/ni/attachments/ni/170/402362/3/add-time.png" border="0" /&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That is a good start and should meet most situations unless your app has to take into concideration DST changes. In that case the constant "24" hours in a day is not always true (one day has 23&amp;nbsp;hours the other day has 25 hours).*&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The other complication that comes inot play is that the dates when DST is turned on and off is dictated by laws that can and do change. THese changes end up in updates to the OS which LV uses to convert the time in seconds into a standard human form.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the only method I have run across that always works is an interactive version that subtracts an hour at a time and then tests the new time to see if it is close to what we want. I saw "close" because if you are doing this check at 2:15 in the moning, three months prior to that time and date the "two-o-clock" hour may or may not exist!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am open to hearing about other approach to the challenge of time so post way if you have ideas!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ben&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;* I for the most part like the ideas that Ben Franklin came up with but the whole DST is not one of my forvorites.&lt;/P&gt;</description>
    <pubDate>Wed, 13 May 2009 14:12:24 GMT</pubDate>
    <dc:creator>Ben</dc:creator>
    <dc:date>2009-05-13T14:12:24Z</dc:date>
    <item>
      <title>Manipulating Months Difference</title>
      <link>https://forums.ni.com/t5/LabVIEW/Manipulating-Months-Difference/m-p/906618#M408554</link>
      <description>&lt;P&gt;Hi everyone... .I have a vi in which I need to subtract 4 months from the date entered in a timestamp control. However the number of days varies depending on the specific month and year that was entered in the control...&lt;/P&gt;&lt;P&gt;For example if I want to subtract 6 months from the entered date I would need the equivalent of the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;FONT size="2"&gt;&lt;FONT face="Verdana"&gt;&lt;SPAN style="color: #943634"&gt;DateDiff(&lt;/SPAN&gt;Month,-6,”2009-04-25”&lt;SPAN style="color: #943634"&gt;)&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;P class="MsoNormal"&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Verdana','sans-serif'"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal"&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Verdana','sans-serif'"&gt;&lt;SPAN style="color: #943634"&gt;&lt;FONT color="#333333"&gt;Any ideas on how to accomplish this???? The time date functions in Labview are all seconds based and I cannot write a constant number of seconds to subtract...&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 May 2009 13:30:28 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Manipulating-Months-Difference/m-p/906618#M408554</guid>
      <dc:creator>Jaime Rodriguez</dc:creator>
      <dc:date>2009-05-13T13:30:28Z</dc:date>
    </item>
    <item>
      <title>Re: Manipulating Months Difference</title>
      <link>https://forums.ni.com/t5/LabVIEW/Manipulating-Months-Difference/m-p/906649#M408559</link>
      <description>I recently wrote and uploaded a VI to do something close in response to a similar question, see &lt;A href="http://forums.ni.com/ni/board/message?board.id=170&amp;amp;message.id=402365#M402365" target="_blank"&gt;here&lt;/A&gt;.&amp;nbsp; It will add any amount of time, not just months but should be quick to modify for subtraction (maybe you can just provide a negative number of months, I haven't tested that). &amp;nbsp; It hasn't been thoroughly tested but is simple enough that if there are bugs you should be able to resolve them easily.&lt;DIV class="message-edit-history"&gt;&lt;SPAN class="edit-author"&gt;Message Edited by nathand on &lt;/SPAN&gt;&lt;SPAN class="local-date"&gt; 05-13-2009&lt;/SPAN&gt;&lt;SPAN class="local-time"&gt; 10:01 AM&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 13 May 2009 14:01:17 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Manipulating-Months-Difference/m-p/906649#M408559</guid>
      <dc:creator>nathand</dc:creator>
      <dc:date>2009-05-13T14:01:17Z</dc:date>
    </item>
    <item>
      <title>Re : Re: Manipulating Months Difference</title>
      <link>https://forums.ni.com/t5/LabVIEW/Manipulating-Months-Difference/m-p/906664#M408563</link>
      <description>Here is an example that I have just written for you. It is not tested to 100%.</description>
      <pubDate>Wed, 13 May 2009 14:12:00 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Manipulating-Months-Difference/m-p/906664#M408563</guid>
      <dc:creator>JB</dc:creator>
      <dc:date>2009-05-13T14:12:00Z</dc:date>
    </item>
    <item>
      <title>Re: Manipulating Months Difference</title>
      <link>https://forums.ni.com/t5/LabVIEW/Manipulating-Months-Difference/m-p/906665#M408564</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;nathand wrote: &lt;BR /&gt;I recently wrote and uploaded a VI to do something close in response to a similar question, see &lt;A href="http://forums.ni.com/ni/board/message?board.id=170&amp;amp;message.id=402365#M402365" target="_blank"&gt;here&lt;/A&gt;.&amp;nbsp; It will add any amount of time, not just months but should be quick to modify for subtraction (maybe you can just provide a negative number of months, I haven't tested that). &amp;nbsp; It hasn't been thoroughly tested but is simple enough that if there are bugs you should be able to resolve them easily. &lt;DIV class="message-edit-history"&gt;&lt;SPAN class="edit-author"&gt;Message Edited by nathand on &lt;/SPAN&gt;&lt;SPAN class="local-date"&gt;05-13-2009&lt;/SPAN&gt;&lt;SPAN class="local-time"&gt; 10:01 AM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have taken the liberty of linking the image of your suggested code below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="http://forums.ni.com/ni/attachments/ni/170/402362/3/add-time.png" border="0" /&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That is a good start and should meet most situations unless your app has to take into concideration DST changes. In that case the constant "24" hours in a day is not always true (one day has 23&amp;nbsp;hours the other day has 25 hours).*&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The other complication that comes inot play is that the dates when DST is turned on and off is dictated by laws that can and do change. THese changes end up in updates to the OS which LV uses to convert the time in seconds into a standard human form.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the only method I have run across that always works is an interactive version that subtracts an hour at a time and then tests the new time to see if it is close to what we want. I saw "close" because if you are doing this check at 2:15 in the moning, three months prior to that time and date the "two-o-clock" hour may or may not exist!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am open to hearing about other approach to the challenge of time so post way if you have ideas!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ben&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;* I for the most part like the ideas that Ben Franklin came up with but the whole DST is not one of my forvorites.&lt;/P&gt;</description>
      <pubDate>Wed, 13 May 2009 14:12:24 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Manipulating-Months-Difference/m-p/906665#M408564</guid>
      <dc:creator>Ben</dc:creator>
      <dc:date>2009-05-13T14:12:24Z</dc:date>
    </item>
    <item>
      <title>Re : Re: Manipulating Months Difference</title>
      <link>https://forums.ni.com/t5/LabVIEW/Manipulating-Months-Difference/m-p/906674#M408569</link>
      <description>Playing with my example, you will see the +-1 hour effect of the DST changes mentionned by Ben.</description>
      <pubDate>Wed, 13 May 2009 14:17:00 GMT</pubDate>
      <guid>https://forums.ni.com/t5/LabVIEW/Manipulating-Months-Difference/m-p/906674#M408569</guid>
      <dc:creator>JB</dc:creator>
      <dc:date>2009-05-13T14:17:00Z</dc:date>
    </item>
  </channel>
</rss>

