you cant just use mod(x,4) logic

the following from some website (dont remember where/when I found it)
***
The rule for leap years is that all years divisable by 4 are leap years, except those years divisable by 100. The exception is that years divisible by 400 are leap years
****
of course only us old foggies that used pick way back when remember this <g>

Rich

Allen E. Elwood wrote:

I've always used the simple method.

*Initialization section
END.DATES = '31,28,31,30,31,30,31,31,30,31,30,31'
END.DATES = CHANGE(END.DATES,',',@AM)

*Main loop section
LAST.DATE = END.DATES<MONTH>
IF MONTH = 2 AND NOT(MOD(YEAR,4)) THEN LAST.DATE+=1

btw, there may be an error in this, my allergies are truly messing with my
head today.....and for the last week....Gaaa

Allen

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Dianne Ackerman
Sent: Thursday, June 02, 2005 11:21 AM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Finding last day of month


That method can actually backfire, for example, if your starting date is
20040130, you'll end up on Feb 29 instead of Jan 31.  What I would do is
replace the day with 01 and add 1 to the month, then iconv and subtract
1 day.
-Dianne

Marco Manyevere wrote:


Hi,

Given a date like 20040203, I want to return the last valid date for that

month and year (20040229 in this case). What is the shortest code fragment
to achieve this?

At the moment I'm replacing the day with 01, then iconv, add 35 days to the

internal date and then oconv and replace the day again with 01. I'm then on
the first day of the next month. I then iconv, subtract 1 day and oconv.

Thanks for any help.

-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/



--
Richard A. Wilson
Lakeside Systems
Smithfield, RI, USA
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to