---
schema_version: "1"
id: 277ecb362251fd9b26f57747b394e9f5abf701afd4d31e658ba74804bff30fab
title: convertTimezone()
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/salesforce-soql-sosl/guides/soql-sosl/sforce-api-calls-soql-select-convert-time-zone.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-soql-sosl/guide/sforce-api-calls-soql-select-convert-time-zone.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 8f795caf0936e5be4cb58332a8e9d8e815728c4ff2162f736134039f1f533c7f
products:
  - SOQL and SOSL Reference
  - Platform Developer Content
---

# convertTimezone()

SOQL queries in a client application return dateTime field values as Coordinated Universal Time (UTC) values. You can use `convertTimezone()` in a date function to convert dateTime fields to the user’s time zone.

For example, you could use the `convertTimezone(dateTimeField)` function to find the sum of the `Amount` values for all your opportunities for each hour of the day, where the hour is converted to the user's time zone.

<!-- otherprops: set_clipboard -->

```soql
SELECT HOUR_IN_DAY(convertTimezone(CreatedDate)), SUM(Amount)
FROM Opportunity
GROUP BY HOUR_IN_DAY(convertTimezone(CreatedDate))
```

Note that you can only use `convertTimezone()` in a date function. The following query doesn't work because there is no date function.

```soql
SELECT convertTimezone(CreatedDate)
FROM Opportunity
```
