Your method is also the way I've always done it, but an alternate method
just came to mind:

MONTH = OCONV(DATE, 'DM')
YEAR = OCONV(DATE, 'D Y[Z4]')
LEAP = MOD(YEAR, 4) = 0
MONTHS = ''
MONTHS<1> = 31
MONTHS<2> = 28 + LEAP
MONTHS<3> = 31
MONTHS<4> = 30
MONTHS<5> = 31
MONTHS<6> = 30
MONTHS<7> = 31
MONTHS<8> = 31
MONTHS<9> = 30
MONTHS<10> = 31
MONTHS<11> = 30
MONTHS<12> = 31
LAST.DAY = MONTHS<MONTH>

Not very concise, but you can tell at a glance how many days your
dealing with.  

-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Holt, Jake
Sent: Tuesday, December 06, 2011 2:34 PM
To: U2 Users List
Subject: Re: [U2] End of Month date routine

Someone has probably already suggested one like this but I use:

DATE = ICONV("2-11-11",'D')
MONTH = OCONV(DATE,"DM")
YEAR = OCONV(DATE,"DY")
MONTH += 1
IF MONTH > 12 THEN
MONTH = 1
YEAR += 1
END

LAST.DAY = ICONV(MONTH:"/1/":YEAR,'D')-1
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to