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.
1SELECT HOUR_IN_DAY(convertTimezone(CreatedDate)), SUM(Amount)
2FROM Opportunity
3GROUP 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.
1SELECT convertTimezone(CreatedDate)
2FROM Opportunity