Bagikan melalui


Today Property

Returns or sets a Date value containing the current date according to your system.

Public Property Today() As DateTime

Remarks

The Date data type includes time components. When returning the system date, Today sets all of these to 0, so the returned value represents midnight (00:00:00). When setting the system date, Today ignores the time components.

To access the current system date as a String, use the DateString Property.

To get or set the current system time, use the TimeOfDay 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.

Example

This example uses the Today property to return the current system date.

Dim thisDate As Date
thisDate = Today

Requirements

Namespace: Microsoft.VisualBasic

Module: DateAndTime

Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)

Because Today is a member of a module, rather than of a class, you do not need to create an object on which to access Today.

Smart Device Developer Notes

You can get but not set the current system date using the Today property.

See Also

Reference

Format Function

Now Property

Date Data Type (Visual Basic)

DateTime