Search code examples
timesalesforce

Salesforce API: get the time on the Salesforce server


With the Salesforce API, is there a way to get the current time on the Salesforce server?


Solution

  • Yes, you can use the getServerTimestamp() method:

    In C#:

    // binding is of type SforceService 
    GetServerTimestampResult timestamp = binding.getServerTimestamp();
    

    In Java:

    // connection is of type EnterpriseConnection 
    GetServerTimestampResult timestamp = connection.getServerTimestamp();
    

    See Salesforce API Docs: getServerTimestamp().