共用方式為


Now Property 

Returns a Date value containing the current date and time according to your system.

ReadOnly Public Property Now() As DateTime

Remarks

To set the system date, use the Today Property. To set the system time, use the TimeOfDay Property.

Example

The following example uses the Now property to return the current system date and time.

Dim ThisMoment As Date
' The following statement calls the Get procedure of the Visual Basic Now property.
ThisMoment = Now

Requirements

Namespace: Microsoft.VisualBasic

Module: DateAndTime

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

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

See Also

Reference

Day Function (Visual Basic)
Hour Function (Visual Basic)
Minute Function
Month Function (Visual Basic)
Second Function (Visual Basic)
Weekday Function (Visual Basic)
Year Function (Visual Basic)
Date Data Type (Visual Basic)
DateTime