Compute the Day of the Week

Table of contents:

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).

Msgbox Weekday(Now)

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

Calendar Applications

Collaborative Applications

Reference Library Applications

Workflow Applications

Web Applications

Design Enhancements Using LotusScript

Design Enhancements Using Formula Language

View Enhancements

Sample Agents

Miscellaneous Enhancements and Tips for Domino Databases

Data Management


Application Deployment and Maintenance


Appendix A. Online Project Files and Sample Applications

Appendix B. IBM® Lotus® Notes® and Domino®Whats Next?

Lotus Notes Developer's Toolbox(c) Tips for Rapid and Successful Deployment
Lotus Notes Developers Toolbox: Tips for Rapid and Successful Deployment
ISBN: 0132214482
EAN: 2147483647
Year: N/A
Pages: 293
Authors: Mark Elliott © 2008-2020.
If you may any questions please contact us: