This LotusScript code will determine the day of the week based on the provided date.
How It Works
One way to manage the day of the week is to utilize the SelectCase statement in conjunction with the Weekday function. The Weekday function returns a numeric value that represents Sunday (1) through Saturday (7). After the numeric value is returned, the appropriate day of the week string is computed via the Select statement.
Set a date value for the dateStamp object. Use the Weekday function to return the day of the week for the specified date value (see Figure 13.10). In the following example, the date is set to the current day. However, this could be any date value, or you could reference a field on a form.
Dim theDayofWeek As String Dim dateStamp As NotesDateTime Set dateStamp = New NotesDateTime("Today") Select Case Weekday(dateStamp.DateOnly) Case 1 theDayofWeek = "Sunday" Case 2 theDayofWeek = "Monday" Case 3 theDayofWeek = "Tuesday" Case 4 theDayofWeek = "Wednesday" Case 5 theDayofWeek = "Thursday" Case 6 theDayofWeek = "Friday" Case 7 theDayofWeek = "Saturday" End Select Msgbox "Today is " & theDayofWeek
Figure 13.10. Compute the day of the week using the Weekday function
The following illustrates a simplified methodology to determine the day of the week (see Figure 13.11). In this example, only the number corresponding to the weekday is returned (e.g., Friday).
Figure 13.11. Example of the Weekday function
How to Reference $ Fields
An Introduction to the Lotus Domino Tool Suite
Getting Started with Designer
Navigating the Domino Designer Workspace
Domino Design Elements
An Introduction to Formula Language
An Introduction to LotusScript
Fundamentals of a Notes Application
Reference Library Applications
Design Enhancements Using LotusScript
Design Enhancements Using Formula Language
Miscellaneous Enhancements and Tips for Domino Databases
Application Deployment and Maintenance
Appendix A. Online Project Files and Sample Applications
Appendix B. IBM® Lotus® Notes® and Domino®Whats Next?