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

需求

命名空間 (Namespace)︰Microsoft.VisualBasic

**模組︰**DateAndTime

組件 (Assembly):Visual Basic Runtime Library (在 Microsoft.VisualBasic.dll 中)

由於 Now 是模組成員,而非類別 (Class) 成員,所以不需要建立存取 Now 的物件。

請參閱

參考

Day 函式 (Visual Basic)

Hour 函式 (Visual Basic)

Minute 函式

Month 函式 (Visual Basic)

Second 函式 (Visual Basic)

Weekday 函式 (Visual Basic)

Year 函式 (Visual Basic)

Date 資料型別 (Visual Basic)

DateTime