Retrieves the current system timestamp (Coordinated Universal Time (UTC) time zone) from the API.
Use getServerTimestamp() to obtain the current system timestamp from the API. You might do this if, for example, you need to use the exact timestamp for timing or data synchronization purposes. When you create() or update() an object, the API uses the system timestamp to update the CreatedDate and LastModifiedDate fields, respectively, in the object.
The getServerTimestamp() call always returns the timestamp in Coordinated Universal Time (UTC) time zone. However, your local system might automatically display the results in your local time based on your time zone settings.
public void getServerTimestampSample() {
// Invoke the getServerTimestamp call and save the results
try {
Calendar serverTime = binding.getServerTimestamp().getTimestamp();
System.out.println("Server time is: " + serverTime.getTime().toString());
} catch (Exception ex) {
System.out.println("An unexpected error has occurred." + ex.getMessage());
}
}
private void getServerTimeStamp()
{
//Invoke the getServerTimeStamp call and save the results
GetServerTimestampResult ts = binding.getServerTimestamp();
// Write the server timestamp to the diagnostics window
System.Diagnostics.Trace.WriteLine(ts.timestamp.ToUniversalTime);
}