GetTime Method  

Obtain the current system date and time.


object.GetTime( [RemoteHost], [RemotePort], [Timeout], [Localize] )


A string which specifies the host name or IP address of the server. If this argument is not specified, it defaults to the value of the HostAddress property if it is defined. Otherwise, it defaults to the value of the HostName property.
A number which specifies the port to connect to on the server. If this argument is not specified, it defaults to the value of the RemotePort property. A value of zero indicates that the default port number for this service should be used to establish the connection.
The number of seconds that the client will wait for a response before failing the operation. If this argument is not specified, the value of the Timeout property will be used as the default.
A boolean argument which specifies if the time should be localized to the timezone on the current system. If the value is True, then the time returned by the server will be adjusted so that it reflects the current time in the local timezone. If this argument is omitted or a value of false is passed to the method, the date and time are returned in Coordinated Universal Time (UTC).

Return Value

The time and date retrieved from the server will be returned as a string formatted according to the user's current locale. If the date could not be retrieved, an empty string will be returned. To determine the cause of the failure, check the value of the LastError property.


The GetTime method causes the control to connect to the specified server and request the current date and time. In the United States, the National Institute of Standards and Technology (NIST) hosts a number of public servers which can be used to obtain the current time. The following table lists the current host names and addresses:

Server Name IP Address Location Gaithersburg, Maryland Gaithersburg, Maryland Redmond, Washington Boulder, Colorado Boulder, Colorado Boulder, Colorado

Time servers are also commonly maintained by Internet service providers and universities. If you are unable to obtain the time from a server, contact the system administrator to determine if they have the standard time service available on port 37.

See Also

LocalDate Property, LocalTime Property, SystemDate Property, SystemTime Property, SetTime Method