Returns an Integer value from 1 through 31 representing the day of the month.
Public Function Day(ByVal DateValue As DateTime) As Integer
If you use the Day function, you might have to qualify it with the Microsoft.VisualBasic namespace, because the System.Windows.Forms namespace defines Day as an enumeration. The following example shows how qualifying Day resolves this ambiguity:
Dim ThisDay As Integer = Microsoft.VisualBasic.Day(Now)
You can also obtain the day of the month by calling DatePart and specifying DateInterval.Day for the Interval argument.
This example uses the Day function to obtain the day of the month from a specified date. In the development environment, the date literal is displayed in standard short format (such as "02/12/1969") using the locale settings of your code.
Dim MyDate As Date Dim MyDay As Integer MyDate = #2/12/1969# ' Assign a date using standard short format. MyDay = Microsoft.VisualBasic.Day(
MyDate)
' MyDay contains 12.
Day is qualified to distinguish it from the System.Windows.Forms.Day enumeration.
Hour Function | Minute Function | Month Function | Now Property | Second Function | Weekday Function | Year Function | DatePart Function |