From: "Marco Manyevere" <[EMAIL PROTECTED]>

> 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?

Find the internal date of the first day of the next month, subtract 1, and
convert it back to external format.

ORIG.YYYY = YYYYMMDD[1,4]
ORIG.MM = YYYYMMDD[5,2]
ORIG.DD = YYYYMMDD[7,2]

I.LAST.DAY = (ICONV(ORIG.YYYY:(ORIG.MM + 1): "01"), "D4/") - 1
O.LAST.DAY = OCONV(I.LAST.DAY, "D4/"
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to