# Convert Time Zone

Converts the time from the current time zone to the requested time zone. If the time doesn’t contain a time zone, the value defined in Input Time Zone is used instead.

This action is available in API version 62.0 and later.

## Supported REST HTTP Methods

**URI:** `/services/data/vXX.X/actions/standard/convertTimeZone`

Where `XX.X` is the latest API version.

**Formats:** JSON, XML

**HTTP Methods:** POST

**Authentication:** `Authorization: Bearer TOKEN`

Where `TOKEN` is a variable.

## Inputs

| Input            | Type   | Description                                                                                                                                                                                                                                                                                                                                    |
| ---------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `time`           | string | Required. The time that requires conversion. It can be with or without a time zone. The format for times that include a time zone is `yyyy-MM-dd'T'HH:mm:ss.SSSXXX`. For example, `2025-02-24T14:30:15.123-05:00`. The format for times that don’t include a time zone is `yyyy-MM-dd'T'HH:mm:ss.SSS`. For example, `2025-02-24T14:30:15.123`. |
| `outputTimeZone` | string | Required. The requested time zone. For example `UTC`.                                                                                                                                                                                                                                                                                          |
| `inputTimeZone`  | string | Optional. The time zone to use if the time doesn’t include a time zone. For example, `America/Los_Angeles`.                                                                                                                                                                                                                                    |

## Outputs

| Output     | Type   | Description                                                                                                                                     |
| ---------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| `dateTime` | string | The time after it's converted to the required time zone, in the format `yyyy-MM-dd'T'HH:mm:ss.SSSXXX`. For example, `2025-02-24T14:30:15.123Z`. |

## Example

Sample request body:

```nolang
{
  "inputs" : [{
    "time" : "2025-02-24T14:30:15.123",
    "outputTimeZone" : "UTC",
    "inputTimeZone" : "America/Los_Angeles"
  }]
}
```

Sample response body:

```nolang
{
  "actionName" : "convertTimeZone",
  "errors" : null,
  "isSuccess" : true,
  "outputValues" : {
    "dateTime" : "2025-02-24T22:30:15.123Z"
  }
}
```
