I'm receiving a datetime string as a response in postman from a service. but when I'm converting the string value to date time. The value is getting converted to date time as expected but it is displaying the user time zone queried or used in table. Is it not possible to convert the date time value from string to dateTime and store in date Time field with the same value?
DateTime gets converted in Salesforce from Postman
apexdatetimelightning-datatablepostman
Best Answer
Date.valueOf
is the wrong method, as it is meant to parse times in the user's time zone. You can useDate.valueOfGmt
instead. Alternatively, considerJSON.deserialize
:This will allow you to parse the date time in GMT without any string manipulation.