Clock.GmtTime 屬性

定義

取得 Date 一個包含電腦當前本地日期與時間的物件,該時間以 UTC(GMT)表示。

public:
 property DateTime GmtTime { DateTime get(); };
public DateTime GmtTime { get; }
member this.GmtTime : DateTime
Public ReadOnly Property GmtTime As DateTime

屬性值

一個 Date 包含當前日期與時間(以 UTC GMT)表示的物件。

範例

此範例使用 該 My.Computer.Clock.GmtTime 屬性來顯示程式碼執行電腦的 GMT 時間。

MsgBox("Current GMT time: " & My.Computer.Clock.GmtTime)

備註

My.Computer.Clock.GmtTime 物件的行為與物件 DateTime.UtcNow 相同。

依專案類型提供可用性

專案類型 Available
Windows 應用程式 Yes
類別庫 Yes
主控台應用程式 Yes
Windows 控件庫 Yes
Web 控制庫 Yes
Windows 服務 Yes
網站 Yes

適用於

另請參閱