You need to sign in to do that
Don't have an account?
Cris9931
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 2 : GMT 2
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
https://help.salesforce.com/articleView?id=000335706&type=1&mode=1
https://help.salesforce.com/articleView?id=formula_using_date_datetime.htm&type=5
https://medium.com/salesforce-zolo/what-every-salesforce-developer-should-know-about-dates-and-times-in-apex-d49bc0a116d4
Let me know if this helps
Thanks,
Anudeep