I am making rest api,
In rest method I recieve Datetime parameter. In javascript datetime string looks this: "2015-12-01T12:44:00.000+0000"
This is in the same format as I recieved from apex rest. My user's timezone is GMT+2.
In apex rest method parameter value is this: "2015-12-01T14:44:00.000+0000". So it automatically parses it and adds 2 hours because of user locale. How can I avoid adding timezone when salesforce parces it without changing string pattern?
Best Answer
If you look at your string, it says "2015-12-01T12:44:00.000+0000" Last 4 digit represent the timezone.
Try below code snippet to convert the string to DateTime.
Details about all parameters in date format string : https://paulforce.wordpress.com/2009/08/27/formatting-time-in-apex/