更新:2007 年 11 月
获取一个 Date 对象,该对象包含计算机上的当前本地日期和时间,表示为 UTC (GMT) 时间。
' Usage
Dim value As Date = My.Computer.Clock.GmtTime
' Declaration
Public ReadOnly Property GmtTime As Date
返回值
包含当前日期和时间的 Date 对象,表示为 UTC (GMT) 时间。
备注
My.Computer.Clock.GmtTime 属性的行为与 DateTime.UtcNow 属性的相同。
示例
此示例使用 My.Computer.Clock.GmtTime 属性来显示代码在其上运行的计算机的 GMT 时间。
MsgBox("Current GMT time: " & My.Computer.Clock.GmtTime)
要求
命名空间:Microsoft.VisualBasic.Devices
类:Clock
**程序集:**Visual Basic 运行库(位于 Microsoft.VisualBasic.dll 中)
按项目类型列出的可用性
项目类型 |
可用 |
---|---|
Windows 应用程序 |
是 |
类库 |
是 |
控制台应用程序 |
是 |
Windows 控件库 |
是 |
Web 控件库 |
是 |
Windows 服务 |
是 |
网站 |
是 |
权限
不需要任何权限。