DateAndTime.Now 屬性

定義

根據您的系統,傳回包含目前日期和時間的值。

public:
 static property DateTime Now { DateTime get(); };
public static DateTime Now { get; }
static member Now : DateTime
Public ReadOnly Property Now As DateTime

屬性值

根據系統目前的日期和時間。

範例

下列範例會 Now 使用 屬性傳回目前的系統日期和時間。

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

備註

若要設定系統日期,請使用 Today 屬性。 若要設定系統時間,請使用 TimeOfDay 屬性。

適用於

另請參閱