Now 属性

更新:2007 年 11 月

返回一个 Date 值,该值包含与系统对应的当前日期和时间。

ReadOnly Public Property Now() As DateTime

备注

若要设置系统日期,请使用 Today 属性。若要设置系统时间,请使用 TimeOfDay 属性

示例

下面的示例使用 Now 属性返回系统的当前日期和时间。

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

要求

命名空间:Microsoft.VisualBasic

**模块:**DateAndTime

**程序集:**Visual Basic 运行库(在 Microsoft.VisualBasic.dll 中)

由于 Now 是模块的成员,而不是类的成员,因此您不需要创建用于访问 Now 的对象。

请参见

参考

Day 函数 (Visual Basic)

Hour 函数 (Visual Basic)

Minute 函数

Month 函数 (Visual Basic)

Second 函数 (Visual Basic)

Weekday 函数 (Visual Basic)

Year 函数 (Visual Basic)

Date 数据类型 (Visual Basic)

DateTime