<?xml version="1.0" encoding="UTF-8"?><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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: A clarion version of System.AddMonths</title>
	<atom:link href="http://www.clarionedge.com/clarion/a-clarion-version-of-systemaddmonths.html/feed" rel="self" type="application/rss+xml" />
	<link>http://www.clarionedge.com/clarion/a-clarion-version-of-systemaddmonths.html</link>
	<description>Get an Edge with Clarion!</description>
	<lastBuildDate>Sun, 10 Jan 2010 03:02:11 +1100</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: John Griffiths</title>
		<link>http://www.clarionedge.com/clarion/a-clarion-version-of-systemaddmonths.html/comment-page-1#comment-187</link>
		<dc:creator>John Griffiths</dc:creator>
		<pubDate>Sun, 10 Jan 2010 03:02:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.clarionedge.com/uncategorized/a-clarion-version-of-systemaddmonths.html#comment-187</guid>
		<description>Hi Brahn, here is source for my function. Enjoy.

! The Prototype
NMDate  FUNCTION(LONG piFromDate,LONG piAnnivOf),LONG

! The Function CODE
NMDate               PROCEDURE  (LONG piFromDate,LONG piAnnivOf)!,LONG ! Declare Procedure
 ! piFromDate is the date in the month which we want to
 ! advance and get the Next Months date. The piAnnivOf is
 ! the day of month value we wish to use as the anniversary
  
NMDater     LONG,AUTO
DAYGOT      LONG,AUTO

  CODE
  CASE piAnnivOf
  OF 1 to 28
    NMDater = date(MONTH(piFromDate)+1, piAnnivOf ,year(piFromDate))
  OF 29 to 31
    NMDater= date(MONTH(piFromDate)+1, piAnnivOf ,year(piFromDate))
    DAYGOT = DAY(NMDater)
    IF DAYGOT &lt; 5
       NMDater = NMDater - DAYGOT
    END
  ELSE
    NMDater = 0
  END ! CASE
  RETURN NMDater

John Griffiths</description>
		<content:encoded><![CDATA[<p>Hi Brahn, here is source for my function. Enjoy.</p>
<p>! The Prototype<br />
NMDate  FUNCTION(LONG piFromDate,LONG piAnnivOf),LONG</p>
<p>! The Function CODE<br />
NMDate               PROCEDURE  (LONG piFromDate,LONG piAnnivOf)!,LONG ! Declare Procedure<br />
 ! piFromDate is the date in the month which we want to<br />
 ! advance and get the Next Months date. The piAnnivOf is<br />
 ! the day of month value we wish to use as the anniversary</p>
<p>NMDater     LONG,AUTO<br />
DAYGOT      LONG,AUTO</p>
<p>  CODE<br />
  CASE piAnnivOf<br />
  OF 1 to 28<br />
    NMDater = date(MONTH(piFromDate)+1, piAnnivOf ,year(piFromDate))<br />
  OF 29 to 31<br />
    NMDater= date(MONTH(piFromDate)+1, piAnnivOf ,year(piFromDate))<br />
    DAYGOT = DAY(NMDater)<br />
    IF DAYGOT &lt; 5<br />
       NMDater = NMDater &#8211; DAYGOT<br />
    END<br />
  ELSE<br />
    NMDater = 0<br />
  END ! CASE<br />
  RETURN NMDater</p>
<p>John Griffiths</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: brahn</title>
		<link>http://www.clarionedge.com/clarion/a-clarion-version-of-systemaddmonths.html/comment-page-1#comment-186</link>
		<dc:creator>brahn</dc:creator>
		<pubDate>Sat, 09 Jan 2010 11:21:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.clarionedge.com/uncategorized/a-clarion-version-of-systemaddmonths.html#comment-186</guid>
		<description>Hi John, thanks for the comment. Yes I would love a copy of your function please!

I see what you mean by adding months in series but on the other hand, the function is doing what it claims to do :)
You could do something like this in clarion but of course this is only if you specifically want the last day of the month:
&lt;code&gt;
thisDate = &#039;31-10-2009&#039;
LOOP i = 1 TO 12
  thisDate = GetLastDayOfMonth(AddMonths(thisDate, i))
END
&lt;/code&gt;

Just for completeness I did a test on the .Net version to see what happens. It does the same thing as you described. 
(Using powershell which is really neat for this kind of adhoc testing!):

&lt;code&gt;
PS C:&gt; $A = Get-Date 31/10/2006; for ($i = 0; $i -lt 11; $i++) {$A = $A.AddMonths($i); $A}
Tuesday, 31 October 2006 12:00:00 AM
Thursday, 30 November 2006 12:00:00 AM
Tuesday, 30 January 2007 12:00:00 AM
Monday, 30 April 2007 12:00:00 AM
Thursday, 30 August 2007 12:00:00 AM
Wednesday, 30 January 2008 12:00:00 AM
Wednesday, 30 July 2008 12:00:00 AM
Saturday, 28 February 2009 12:00:00 AM
Wednesday, 28 October 2009 12:00:00 AM
Wednesday, 28 July 2010 12:00:00 AM
Saturday, 28 May 2011 12:00:00 AM
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Hi John, thanks for the comment. Yes I would love a copy of your function please!</p>
<p>I see what you mean by adding months in series but on the other hand, the function is doing what it claims to do <img src='http://www.clarionedge.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
You could do something like this in clarion but of course this is only if you specifically want the last day of the month:<br />
<code><br />
thisDate = '31-10-2009'<br />
LOOP i = 1 TO 12<br />
  thisDate = GetLastDayOfMonth(AddMonths(thisDate, i))<br />
END<br />
</code></p>
<p>Just for completeness I did a test on the .Net version to see what happens. It does the same thing as you described.<br />
(Using powershell which is really neat for this kind of adhoc testing!):</p>
<p><code><br />
PS C:> $A = Get-Date 31/10/2006; for ($i = 0; $i -lt 11; $i++) {$A = $A.AddMonths($i); $A}<br />
Tuesday, 31 October 2006 12:00:00 AM<br />
Thursday, 30 November 2006 12:00:00 AM<br />
Tuesday, 30 January 2007 12:00:00 AM<br />
Monday, 30 April 2007 12:00:00 AM<br />
Thursday, 30 August 2007 12:00:00 AM<br />
Wednesday, 30 January 2008 12:00:00 AM<br />
Wednesday, 30 July 2008 12:00:00 AM<br />
Saturday, 28 February 2009 12:00:00 AM<br />
Wednesday, 28 October 2009 12:00:00 AM<br />
Wednesday, 28 July 2010 12:00:00 AM<br />
Saturday, 28 May 2011 12:00:00 AM<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Griffiths</title>
		<link>http://www.clarionedge.com/clarion/a-clarion-version-of-systemaddmonths.html/comment-page-1#comment-185</link>
		<dc:creator>John Griffiths</dc:creator>
		<pubDate>Sat, 09 Jan 2010 09:31:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.clarionedge.com/uncategorized/a-clarion-version-of-systemaddmonths.html#comment-185</guid>
		<description>One problem I found using this type of function, was that, given your #2 example.. then adding a month at a time your series would look like..

31-Oct-2009
30-Nov-2009
30-Dec-2009  ! Here I would want 31-Dec
30-Jan-2010   ! Here I would want 31-Jan
28-Feb-2010  ! OK
28-Mar-2009   ! Here I would want 31-Mar

I wrote a func to manage it my way, and it is on Clarionmag I think.

email to  globaljohnREMOVEatREMOVE gmail.com if anyone wants a copy.

John Griffiths</description>
		<content:encoded><![CDATA[<p>One problem I found using this type of function, was that, given your #2 example.. then adding a month at a time your series would look like..</p>
<p>31-Oct-2009<br />
30-Nov-2009<br />
30-Dec-2009  ! Here I would want 31-Dec<br />
30-Jan-2010   ! Here I would want 31-Jan<br />
28-Feb-2010  ! OK<br />
28-Mar-2009   ! Here I would want 31-Mar</p>
<p>I wrote a func to manage it my way, and it is on Clarionmag I think.</p>
<p>email to  globaljohnREMOVEatREMOVE gmail.com if anyone wants a copy.</p>
<p>John Griffiths</p>
]]></content:encoded>
	</item>
</channel>
</rss>
