You need to sign in to do that
Don't have an account?

Javascript date object to Apex datetime, apex remoting
Hey all,
Just a quick simple question.
Trying to update an object through Apex remoting. One of the fields I am attempting to update is a date time. In what format do I need to pass a datetime for it to work? I've tried just passing a date object, and date.toUTCString(). How do I need to format the datetime in javascript for apex to be able to deal with it? Thanks!
The exact error is
Visualforce Remoting Exception: Upsert failed. First exception on row 0 with id a06S0000003yxF8IAI; first error: INVALID_TYPE_ON_FIELD_IN_RECORD, Start Date: value not of required type: 2012-02-03T14:46:00Z: [Start_Date__c]
and here is the javascript method I am using to create and send the object with the date to my method.
And not that it really matters, but this is my controller method.
Constructs a Datetime from Integer representations of the year, month (1=Jan), day, hour, minute, and second in the local time zone. For example:
Datetime myDate = datetime.newInstance(2008, 12, 1, 12, 30, 2);
I too am struggling with this issue. Date fields inside SObjects don't seem to get serialized properly, and the format used for plain Date parameters (UTC string) doesn't work when it's a field of an SObject parameter. I've turned this into a StackExchange question, maybe it will get some traction there.