0001: INPUT DATE
0002: USE.DATE = ICONV(DATE,"D")
0003: MTH = OCONV(USE.DATE,"DM")
0004: YR = OCONV(USE.DATE,"DY4")
0005: IF MTH LT 12 THEN
0006: MTH += 1
0007: END ELSE
0008: MTH = 1
0009: YR += 1
0010: END
0011: NEW.DATE = ICONV(MTH:"/01/":YR,"D") - 1
0012: CRT OCONV(NEW.DATE,"D")


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Marco Manyevere
Sent: Thursday, June 02, 2005 10:31 AM
To: u2-users@listserver.u2ug.org
Subject: [U2] Finding last day of month

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.

                
---------------------------------
Yahoo! Messenger NEW - crystal clear PC to PCcalling worldwide with
voicemail
-------
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/

Reply via email to