You need to sign in to do that
Don't have an account?
Cris9931
why my DateTime field keeps converting in local time zone?
I have a DateTime text field.
I created a short trigger to convert this DateTime text in actual DateTime.
If I take a look on my work details I see that Start Date/Time - Device is not the same with what I received in my system debug...
This is how it looks without any time conversion, its basically a text of DateTime.
But when I system debug this I get converted value:
How can I get the original value from the WEB and avoid the time conversion? Please help.. I'm stuck with this.
I created a short trigger to convert this DateTime text in actual DateTime.
List<Id> listWoId = new List<Id>(); for(SVMXC__Service_Order__c loopwo : Trigger.new){ listWoId.add(loopwo.Id); } List<SVMXC__Service_Order_Line__c> currentWL = [SELECT ID, Name, SIG_Start_Date_Time_Device__c , SIG_End_Date_Time_Device__c from SVMXC__Service_Order_Line__c where SVMXC__Service_Order__c =: listWoId]; for(SVMXC__Service_Order_Line__c workDetail : currentWL ){ DateTime dt = DateTime.valueOf(workDetail.SIG_Start_Date_Time_Device__c); System.debug('Work Detail Number: ' +workDetail.Name + ' ##### ' + 'DateTime :' + dt); }
If I take a look on my work details I see that Start Date/Time - Device is not the same with what I received in my system debug...
This is how it looks without any time conversion, its basically a text of DateTime.
But when I system debug this I get converted value:
How can I get the original value from the WEB and avoid the time conversion? Please help.. I'm stuck with this.
This is the answer that works:
All Answers
As per Datetime class documentation
valueOf(fieldValue)
Converts the specified object to a Datetime. Use this method to convert a history tracking field value or an object that represents a Datetime value.
Also, I recommend trying the solution listed here
Let me know if this helps, if it does, please close the query by marking it as solved. It may help others in the community. Thank You!
This is the answer that works: