DateAndTime.Day(DateTime) Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns an integer value from 1 through 31 representing the day of the month.
public:
static int Day(DateTime DateValue);
public static int Day(DateTime DateValue);
static member Day : DateTime -> int
Public Function Day (DateValue As DateTime) As Integer
- DateValue
- DateTime
Required. A Date
value from which you want to extract the day.
An integer value from 1 through 31 representing the day of the month.
The following 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 oldDate As Date
Dim oldDay As Integer
' Assign a date using standard short format.
oldDate = #2/12/1969#
oldDay = Microsoft.VisualBasic.DateAndTime.Day(oldDate)
' oldDay now contains 12.
Day
is qualified to distinguish it from the System.Windows.Forms.Day enumeration.
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.DateAndTime.Day(Now)
You can also obtain the day of the month by calling DatePart
and specifying DateInterval.Day
for the Interval argument.
Производ | Верзије |
---|---|
.NET | Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET повратне информације
.NET је пројекат отвореног кода. Изаберите везу да бисте обезбедили повратне информације: