Day Function

Returns a whole number between 1 and 31, inclusive, representing the day of the month.

Syntax

Day(date)

Arguments:

Date: Required. Any expression that can represent a date.

Supported Date Formats:

  • MM-DD-YYYY
  • MM/DD/YYYY
  • DD-MM-YYYY
  • DD/MM/YYYY
  • YYYY-MM-DD
  • YYYY/MM/DD

Remarks

The following example uses the Day function to obtain the day of the month from a specified date:

Example 1:

Dim MyDate, MyDay
MyDate = "21/01/2025"
MyDay = Day(MyDate)   
'Output: 21

Example 2:

Dim MyDay
MyDay = Day(Date)
'Output: If current date is 22 January 2025, then it returns 22

Example 3:

Dim MyDate, MyDay
MyDate = DateAdd("d", 10, "21/01/2025")   
MyDay = Day(MyDate)   
'Output: 31