See Also Example
Returns an integer between 1 and 31, inclusive, that represents the day of the month for a date argument.
Syntax
Day(dateexpression)
Remarks
The dateexpression part of the syntax is any numeric expression Numbers to the left of the decimal point in dateexpression represent the date; numbers to the right represent the time. Negative numbers represent dates prior to December 30, 1899.
If dateexpression is Null
Date, Date$ Functions
Date, Date$ Statements
Hour Function
Minute Function
Month Function
Now Function
Second Function
Weekday Function
Year Function
The example uses the Day function to determine the day of the month. To try this example, paste the code into the Declarations section of a form. Then press F5 and click the form.
Sub Form_Click ()
Dim DayNum, DaySuffix ' Declare variables.
DayNum = Day(Now) ' Get the current day number.
Select Case DayNum ' Get the proper suffix
Case 1, 21, 31 ' for each number.
DaySuffix = "st"
Case 2, 22
DaySuffix = "nd"
Case 3, 23
DaySuffix = "rd"
Case Else
DaySuffix = "th"
End Select
MsgBox "Today is the " & DayNum & DaySuffix & " day of the month."
End Sub