DateAndTime.TimeOfDay Property

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)

public static DateTime TimeOfDay { get; set; }
/** @property */
public static DateTime get_TimeOfDay ()

/** @property */
public static void set_TimeOfDay (DateTime Value)

public static function get TimeOfDay () : DateTime

public static function set TimeOfDay (Value : DateTime)

Property Value

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

For more detailed information, see the Visual Basic topic TimeOfDay Property.

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 or set the current system date, use the Today Property.

Security noteSecurity Note

Setting the system date or time requires unmanaged code permission, which might affect its execution in partial-trust situations. For more information, see SecurityPermission and Code Access Permissions.

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

Dim currentTime As Date
currentTime = TimeOfDay

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions

ADD
Show: