+ Start a Discussion

Datetime corrupted when send to Visualforce page

This VF page also displays future activities, but this are displayed -10hours, so the user who is booking the activity is getting wrong available times.
The way that I am using to send the datetime into VF page is by json.serialize.
i.e:this is what the vf page is receiving:
[{"title":"Meeting 1","start":"2014-08-01T08:30:00.000Z","id":"Meeting1","end1":"2014-08-01T10:30:00.000Z"}]
when the time for this appointment should be at 6.30pm
The way I am sending the time from VF Page to Controller
jQuery( 'input[id$=StartDateVisualForcePage]' ).val(Date.parse(start));
startMeetingTime = datetime.valueOf(StartDateVisualForcePage);
I am using arshaw calendar
Best Answer chosen by Manza
Alex TennantAlex Tennant
Salesforce stores it's DateTimes in GMT in the database and then translates them into the user's locale when displaying them on the page. If you are interacting with Salesforce dates in JavaScript then you need to account for this either within your JavaScript or within your Apex.

When passing dates to Salesforce you should try and pass them in GMT, if doing it in JavaScript then the getTimezoneOffset() method should help you achieve what you need.