<pre>
* Find the first day of month / last day of month
D StrDate S D
D EndDate S D
/FREE
StrDate = %date(%subst(%char(%date()):1:8) + '01':*ISO);
EndDate = StrDate + %months(1) - %days(1);
/END-FREE </pre>
----------------------------------------------
I keep these calculations handy, but they can be converted into procedures easily
<pre>
d PriorMonthBegin...
d s d
d PriorMonthEnd s d
d MonthBegin s d
d MonthEnd s d
*Mon = 0 ... Sun = 6
d DayOfWeek s 1p 0
d WeekDay s n
d WeekEnd s n
PriorMonthBegin = %date() - %months(1) - %days(%subdt(%date() - %months(1):*days)) + %days(1);
PriorMonthEnd = %date() - %days(%subdt(%date():*days));
MonthBegin = %date() - %days(%subdt(%date():*days)) + %days(1);
MonthEnd = %date() + %months(1) - %days(%subdt(%date() + %months(1):*days));
DayOfWeek = %rem(%diff(%date():d'0001-01-01':*days):7);
WeekDay = %rem(%diff(%date():d'0001-01-01':*days):7) < 5;
WeekEnd = %rem(%diff(%date():d'0001-01-01':*days):7) > 4;
</pre>
Kevin - <a href="http://www.aresgrp.com">Affiliated</a>
=======================================================
If you are current with your OS, you can use the SQL LAST_DAY(CURRENT DATE) function. It's not available for CL of course, but REXX can access it and report the result back out.
Tom
Last Wiki Answer Submitted: June 7, 2010 4:32 am by TomLiotta110,115 pts.
If you live outside the United States, by submitting your email address you consent to having your personal data transferred to and processed in the United States.
// another way to get just the last day of this month
EndDate = %date() + %month(1) – %subdt(%date() + %month(1):*days);
ha – Great minds think alike, huh Graybeard52?
Must be the facial hair !
I think Graybeard and BigKat are the same person, Martin.
Martin? Martin?
Yikes! You are ALL the same hairy person!
Sloopy, after a long lunch….
Hey Sloopy,
Was that a long liquid lunch?
Cheers,
Martin.
hmm…
my picture makes me look like the MCP in the movie TRON.
Yes, Martin.
Otherwise I would not post such stuff about three very large men with beards….