getServerTimestamp()

Retrieves the current system timestamp (Coordinated Universal Time (UTC) time zone) from the API.

Syntax

GetServerTimestampResult timestamp = binding.getServerTimestamp();

Usage

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.

Note
Development tools differ in the way that they handle time data. Some development tools report the local time, while others report only the Coordinated Universal Time (UTC) time zone. To determine how your development tool handles time values, refer to its documentation.

Sample Code—Java

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()); 
  } 
} 

Sample Code—C#

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); 
}

Arguments

None.

Response

getServerTimestampResult

Fault

UnexpectedErrorFault

© Copyright 2000-2010 salesforce.com, inc. All rights reserved.
Various trademarks held by their respective owners.