I am making a callout to external system and I am receiving datetime like
Now, if I do like
String startDate = '2018-10-07T18:00:00'; DateTime testDateTime = DateTime.valueOf(String.valueOf(startDate).replace('T',' '));
Output That I get is :
2018-10-07 12:30:00 its in GMT format.
When I execute this code it takes current user timezone into consideration.
My logged in user time zone is
12.30 GMT is
6 PM IST.So if I update datetime field and see value on pagelayout considering user timezone to IST it will show me 6 PM IST.
However what I want to achieve is, the string that I get from API is of
If '2018-10-07T18:00:00' ,
6 PM EST is
3.30 AM IST then when I will store value of this String into datetime field at Salesforce side it should show me correct value based on logged in user timezone converting from EST.
Any thoughts would be appreciated.