+ Start a Discussion

How to convert from GMT(Date/Time) to UTC(Date/Time)(no timezone conversion)

Hi, I've wrote a trigger to fetch the old Date/Time from a field and store in a new field.. The problem is that it is converting in Local Time and not in UTC... How can I convert my date in UTC timezone?

trigger StartDateTime on SVMXC__SVMX_Event__c (before update) {
 for(SVMXC__SVMX_Event__c even : Trigger.New){
    if(even.SVMX_PS_Validated__c == FALSE && (Trigger.newMap.get(even.id).SVMXC__StartDateTime__c) != Trigger.oldMap.get(even.id).SVMXC__StartDateTime__c) {
       even .Original_Date_StartDateTime__c = Trigger.oldMap.get(even.id).SVMXC__StartDateTime__c;



I see two different timezones

User 1 : GMT 3

User-added image

User 2 : GMT 2

User-added image

AnudeepAnudeep (Salesforce Developers) 
Hi Cristian - You can make use of the Timezone class to do the conversion. However, it is important to understand the root cause of this behavior

Salesforce stores all Date/Time fields internally in UTC (Universal Time Coordinated) time. If you are not seeing a UTC value, I recommend checking the users time zone

Please see the following resources to learn more about how Date/Time fields are stored




Let me know if this helps