If it's for a UniData dictionary you can use the function LAST_DAY(date) that will return the last day of the month. I'm not sure if UniVerse has this function as well.
Eg: 001: I 002: LAST_DAY(INVOICE.DATE) 003: D4 004: Last Day of Month 005: 15R 006: S Colin Alfke Calgary, Canada >-----Original Message----- >From: Cliff Bennett > >Hi, Marco. I always ICONV the first day of the next month, >then subtract a day. For example: > >ANY.DATE = '02-03-2004' >MO = ANY.DATE[1,2] >YR = ANY,DATE[7,4] >MO += 1 >IF MO > 12 THEN > MO = 1 > YR += 1 >END >EOM.DATE = ICONV(MO:'-01-':YR, 'D') - 1 > >This lends itself to a subroutine or function as well. > >Regards, Cliff > >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/