# `getServerTimestamp()`

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

## Syntax

```java
GetServerTimestampResult timestamp = connection.getServerTimestamp();
```

## Usage

Use `getServerTimestamp()` to obtain the current system timestamp from the API. Run this call 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 automatically displays 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

This sample gets the server time and writes it to the console in the user’s local time zone.

```codesegment
public void doGetServerTimestamp() {
   try {
      GetServerTimestampResult result = connection.getServerTimestamp();
      Calendar serverTime = result.getTimestamp();
      System.out.println("Server time is: "
            + serverTime.getTime().toString());
   } catch (ConnectionException ce) {
      ce.printStackTrace();
   }
}
```

## Sample Code—C\#

This sample gets the server time and writes it to the console in the user’s local time zone.

```codesegment
public void doGetServerTimestamp()
{
   try
   {
      GetServerTimestampResult result =
            binding.getServerTimestamp();
      DateTime serverTime = result.timestamp;
      Console.WriteLine("Server time is: " +
            serverTime.ToLocalTime().ToString());
   }
   catch (SoapException e)
   {
      Console.WriteLine("An unexpected error has occurred: " +
                        e.Message + "\n" + e.StackTrace);
   }
}
```

## Arguments

None.

## Response

[getServerTimestampResult](/docs/platform/api/guide/sforce-api-calls-getservertimestamp-getservertimestampresult.md)

## Fault

[`UnexpectedErrorFault`](/docs/platform/api/guide/sforce-api-calls-concepts-core-data-objects.md)

**See Also**

- [Utility Calls](/docs/platform/api/guide/utility-calls.md)
