Partager via


DateAndTime.TimeOfDay Property

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

Returns or sets a Date value containing the current time of day according to your system.

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

Syntax

'Declaration
Public Shared ReadOnly Property TimeOfDay As DateTime
public static DateTime TimeOfDay { get; }

Property Value

Type: System.DateTime
Gets a Date value containing the current time of day according to your system.

Remarks

The Date data type includes date components. When returning the system time, TimeOfDay sets these all to 1, so the returned value represents the first day of the year 1. When setting the system time, TimeOfDay ignores the date components.

To access the current system time as a String, use the TimeString property.

To get the current system date, use the Today property.

Examples

This example uses the TimeOfDay property to return the current system time.

Dim currentTime As Date
currentTime = TimeOfDay

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.