My.Computer.Clock.GmtTime Property
Gets a Date object that contains the current local date and time on the computer, expressed as a UTC (GMT) time.
' Usage
Dim value As Date = My.Computer.Clock.GmtTime
' Declaration
Public ReadOnly Property GmtTime As Date
Return Value
A Date object that contains the current date and time expressed as UTC (GMT) time.
Remarks
The My.Computer.Clock.GmtTime property has the same behavior as the System.DateTime.UtcNow property.
Example
This example uses the My.Computer.Clock.GmtTime property to display the GMT time of the computer on which the code runs.
MsgBox("Current GMT time: " & My.Computer.Clock.GmtTime)
Requirements
Namespace: Microsoft.VisualBasic.Devices
Class: Clock
Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)
Availability by Project Type
Project type | Available |
---|---|
Windows Application |
Yes |
Class Library |
Yes |
Console Application |
Yes |
Windows Control Library |
Yes |
Web Control Library |
Yes |
Windows Service |
Yes |
Web Site |
Yes |
Permissions
No permissions are required.
See Also
Reference
My.Computer.Clock Object
My.Computer.Clock.LocalTime Property
System.DateTime.UtcNow
Microsoft.VisualBasic.Devices.Clock.GmtTime