On 05/12/11 20:10, George Gallen wrote:
Haven't checked it, but what happens on 01/31 by adding 31, it should take you
March, backing up
Will give you 02/xx (28 or 29)?
Others have picked up on it, but if today is 31/1 :-) the first
conversion gives us "Jan 20XX" *before* adding the 31. If the iconv then
works as I expect (from what others have said, maybe it only works in
INFORMATION flavour?) this then gives us 1st Feb, before subtracting 1
to give us 31st Jan as the last day of the current (Jan) month.
Cheers,
Wol
George
-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wols Lists
Sent: Monday, December 05, 2011 3:05 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] End of Month date routine
On 05/12/11 19:03, Wjhonson wrote:
Does someone have a routine that, no matter what day you run it, returns the
End of Month Date ?
(Assume the end of month date, is the calendar end of month date not some
screwy business date)
Hmmm... no-one seems to have done my approach ...
TODAY = @DATE
THIS.MONTH.O = OCONV (TODAY, "DMY") ;* strip day off
NEXT.MONTH.I = ICONV( THIS.MONTH.O, "D") + 31 ;* random day next month
NEXT.MONTH.O = OCONV( NEXT.MONTH.I, "DMY") ;* strip day off
LAST.DAY.I = ICONV( NEXT.MONTH.O, "D") - 1 ;* subract one day
If you don't have a day in your i/oconv it defaults to 1, so the logic
works. Unfortunately you can't combine the first three lines because
there's no number you can pick that will guarantee to land you in next
month whatever today's date :-(
Cheers,
Wol
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users