GetServerDateTime

<< Click to Display Table of Contents >>

Navigation:  Apollo VCL Components > Apollo VCL Component Reference > TApolloConnection > TApolloConnection Methods >

GetServerDateTime

Declaration

function GetServerDateTime: TDateTime;

Description

Returns the current date/time of the remote server machine running an Apollo Database Server. This function is simple but very handy. It allows you to make sure that your client's date/time is in sync with the server.

 

It is possible that your server could be in a different time zone than your clients. For example, a client on the east coast of the U.S. connecting to a server on the west coast of the U.S. will have a different time than the server.

 

Suppose a record is time stamped by a client on the east coast and half an hour later a second client connects from the mid-west of the U.S. They might see records with time stamps that have not even been reached in their time zone. This can create a lot of confusion. The best thing to do is sync everyone with the server. Call this function prior to stamping any records that use time and date values.

Delphi Example

ShowMessage( 'Server date and time is: ' +

DateTimeToStr( ApolloConnection1.GetServerDateTime ));