Aracılığıyla paylaş


DateAndTime.Day Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Returns an Integer value from 1 through 31 representing the day of the month.

Namespace:  Microsoft.VisualBasic
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)

Syntax

'Declaration
Public Shared Function Day ( _
    DateValue As DateTime _
) As Integer
public static int Day(
    DateTime DateValue
)

Parameters

  • DateValue
    Type: System.DateTime
    Required. Date value from which you want to extract the day.

Return Value

Type: System.Int32
Returns an Integer value from 1 through 31 representing the day of the month.

Remarks

You can also obtain the day of the month by calling DatePart and specifying DateInterval.Day for the Interval argument.

Examples

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.

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.