[Remind-Fans] 5th business day of the month
David F. Skoll
dfs at roaringpenguin.com
Sat Oct 16 11:38:50 EDT 2010
On Sat, 16 Oct 2010 06:13:58 -0600
Harold Ditchfield <hditchfield at shaw.ca> wrote:
> I have a requirement for identifying the 5th business day of the
> month. This would omit holidays, SAT and SUN. so the 5th business day
> would normally fall anywhere between the 5th and the 8th of the month
[...]
> SET FIRST date( year( today() ), monnum( today() ), 1 )
> IF [ nonomitted( FIRST, today(), "SAT", "SUN" ) == 4 ]
> REM [ today() ] +3 OMIT SAT SUN AFTER MSG 5TH Business DAY %b.%
> ENDIF
If you are using the latest Remind, you can use the built-in "slide"
and "evaltrig" functions:
REM [slide(evaltrig("1 OMIT SAT SUN AFTER", today()-15), 4, "Sat", "Sun")] +3 \
MSG 5th Business Day %b.
So looking at it from the inside out:
evaltrig("1 OMIT SAT SUN AFTER") gets you the *first* business day of the
month. We start scanning from 15 days ago because otherwise (for example)
if we evaluate the trigger on October 2nd, the Remind algorithm would
pick a date in *November*, which is too far in the future.
Once we have our first business day of the month, we use the slide
function to slide forward by 4 days, not counting globally-omitted days
or weekends.
Regards,
David.
More information about the Remind-fans
mailing list