Day()

Syntax

Day(SerialNumber)

Remarks

Returns an integer between 1 and 31, inclusive, corresponding to the day component of SerialNumber, a decimal representation of the date, time, or both. For information about serial numbers, see DateSerial().

Argument

Explanation

SerialNumber

The serial number used by Word for date and time calculations. SerialNumber can represent a date or time (or both) from December 30, 1899, through December 31, 4095, where December 30, 1899, is 0 (zero).


Example

This example uses the Day() function to determine the day of the month, and then displays the result in a message box with the appropriate suffix (for example, "3rd"):


daynumber = Day(Now())
Select Case daynumber
    Case 1, 21, 31
        daysuffix$ = "st"
    Case 2, 22
        daysuffix$ = "nd"
    Case 3, 23
        daysuffix$ = "rd"
    Case Else
        daysuffix$ = "th"
End Select
MsgBox "Today is the" + Str$(daynumber) + \
        daysuffix$ + " day of the month."

See Also

DateSerial(), Hour(), Minute(), Month(), Now(), Second(), Today(), Weekday(), Year()