I might offer a small modification to your code snippet as noted below.
BobW > > 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] > * IN CASE IT'S DECEMBER IF ORIG.MM = 12 THEN ORIG.YYYY += 1 ORIG.MM = 0 END > I.LAST.DAY = (ICONV(ORIG.YYYY:(ORIG.MM + 1): "01"), "D4/") - 1 > O.LAST.DAY = OCONV(I.LAST.DAY, "D4/") ------- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/