共用方式為


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

適用於

另請參閱