function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Dru - Cloud62Dru - Cloud62 

Java Partner Wsdl DateTime

Using the addField or setField method on SObject, I get an error when trying to add a DateTime though it is in the format SF specified. YYYY-MM-DDThh:mm:ssZ.

 

soReturn.setField("File_Modified_Date__c", "2012-02-08T21:49:59.000Z");

 

Error: File Modified Date: value not of required type: 2012-02-08T21:49:59.000Z

Best Answer chosen by Admin (Salesforce Developers) 
SuperfellSuperfell

I beleive you need to set the value with a Calendar object, not a string.

All Answers

SuperfellSuperfell

I beleive you need to set the value with a Calendar object, not a string.

This was selected as the best answer
Dru - Cloud62Dru - Cloud62

I've tried setting the value as a Java Date set with the File.lastModified() and it seems like it truncates the time component and then sets it to UTC.

 

Which means the date/time I'm trying to upload is 2/8/2012 4:49:49 PM Est and when queried in SF it returns 2/8/2012 0:00:00 Z.

Also, when viewing the time in SF it is showing as 2/7/2012 4:00 PM.

Dru - Cloud62Dru - Cloud62

Setting it as a Java Date didn't work but if you pass the calendar it does. Thanks for your help.