Manage Learn to apply best practices and optimize your operations.

Specific day of the month

If you've ever had to determine a specific day of the month, for example the third Tuesday or the first Thursday, then this formula can help you out.

If you've ever had to determine a specific day of the month, for example the third Tuesday or the first Thursday, then this formula can help you out. It was designed to determine an upcoming specified day of the month, but can be easily altered to determine the specified day for any date input by replacing the @Now with your date.
REM "Enter cardinal number of the 
ordinal you want.  (eg. "first" = 1, "third" = 3)";
ordinal := 3;
REM "Enter the numeric day of the week 
(dow). ("Sunday" = 1 to "Saturday" = 7)";
reqdow := 3;
REM "========== End Developer Changes
 ==================";
minday := ((ordinal -1) * 7) + 1;
curyear := @Year(@Now); 
curmonth := @Month(@Now); 
curday := @Day(@Now);
curdow := @Weekday(@Date( curyear ; 
curmonth ; minday)); 
curreqday := @If(curdow > reqdow; 8 - 
curdow + minday; reqdow - curdow + minday);

REM "If the date has already passed for
 this month, repeat with the next month";
@If(curday > curreqday; 
 @Do(
  @If(curmonth = 12; 
   @Set("curyear"; curyear + 1); 
   ""); 
  @Set("curmonth"; @If(curmonth =12; 1; 
curmonth + 1));
  @Set("curdow"; @Weekday(@Date(
 curyear ; curmonth ; minday)));
  @Set("curreqday"; @If(curdow > reqdow; 
(reqdow + 7) - curdow + minday; reqdow - 
curdow + minday))
  ); 
 "");
REM "End getting next month's date";

specday := @Date(curyear; curmonth; curreqday);
@If(@Text(specday) = ""; @Error; specday)

Dig Deeper on Lotus Notes Domino Formula Language

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close