Q
Problem solve Get help with specific problems with your technologies, process and projects.

Can the @Weekday function be manipulated for 14 days?

A reader wants to know if the @Weekday function in Domino can be manipulated for 14 days.

Can the @Weekday function in Notes/Domino be manipulated for 14 days since it only goes to 7 days?
This is a bit difficult to answer without knowing exactly what you're trying to accomplish. However, here's an idea that I hope will be helpful.

We need to have a fixed starting point for calculating the 14-day periods, and, for it to return the value that you want, that starting point needs to be any Sunday.

Dates can be subtracted, so subtract the current day (or any date) from that start date to get the time difference in seconds. There are 86,400 seconds in a day, so to find the number of days between today and the first Sunday in the year, the formula is ([Today] – [Start Date]) / 86400.

Now you have the number of days between the current date and the start date. You can use the @Modulo function to divide up the time difference into 14-day periods and return the number of the day in a 14-day period. You'll need to add 1, because the first Sunday would return 0. So the formula would look something like this:

tFirstSunday := [1/2/2005];
tNumDays := (@Today - tFirstSunday) / 86400;
tModulo := @Modulo(tNumDays; 14) + 1;
@Prompt([OK]; ""; 
"Modified @Weekday value: " + @Text(tModulo));

As long as the starting point is a Sunday, you'll get a return value of between 1 and 14. (You could also just use the Saturday before the Sunday start date and not need to add 1 to the result, but it's easier to understand the code if you start with a Sunday.)

Do you have comments on this Ask the Expert question and response? Let us know.

Dig Deeper on Lotus Notes Domino Formula Language

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

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