Excel: Day Function
In Excel, the Day function returns the day of the month (a number from 1 to 31) given a date value.
The syntax for the Day function is:
Day( date )
date_value is a valid date.
Applies To:
- Excel 2007, Excel 2003, Excel XP, Excel 2000
For example:
Let's take a look at an example:

Based on the Excel spreadsheet above:
=Day(A1) would return 15. =Day(A2) would return 31. =Day(A3) would return 28.
VBA Code
The Day function can be used in VBA code. For example:
Dim LDay As Integer
LDay = Day("12/31/2001")
In this example, the variable called LDay would now contain the value of 31.