Here's how I do it...

JJ = ICONV(THE.DATE, 'D')
MO = OCONV(JJ, 'DM')
YR= OCONV(JJ, 'DY')
DAY=28
LOOP
  TRY = OCONV(ICONV(MO:'/':DAY+1:'/':YR, 'D'), 'DM')
WHILE TRY = MO DO REPEAT
LAST.DAY = MO:'/':DAY:'/':YR

Perry Taylor

 -----Original Message-----
From:   Marco Manyevere [mailto:[EMAIL PROTECTED]
Sent:   Thu Jun 02 14:05:42 2005
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/

CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is for
the sole use of the intended recipient(s) and may contain confidential and
privileged information.  Any unauthorized review, use, disclosure or
distribution is prohibited. ZirMed, Inc. has strict policies regarding the
content of e-mail communications, specifically Protected Health Information,
any communications containing such material will be returned to the
originating party with such advisement noted. If you are not the intended
recipient, please contact the sender by reply e-mail and destroy all copies of
the original message.
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to