I'm getting 'CSV Parse error 2016-12-02 13:45:21 is not a valid value for the type xds:dateTime' from compiler.

I've done sample test data in CSV file according to: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_testing_load_data.htm I added column 'LastViewedDate' with the date: '2016-12-02 13:45:21'. MIME-Type of this static resource is 'application/vnd.ms-excel' and I can't change but is still supported according to documentation.

What is the proper dateTime format of this field or file?

enter image description here

enter image description here


You need to use ISO 8601 date formats in the CSV.

So your 2016-12-02 13:45:21 becomes 2016-12-02T13:45:21.000Z.

The following CSV resource worked for me to set both the LastViewedDate and CreatedDate.

sForceTest1,http://www.sforcetest1.com,(415) 901-7000,The Landmark @ One Market,San Francisco,CA,94105,US,2016-12-02T13:45:21.000Z,2016-11-02T13:45:21.000Z
sForceTest2,http://www.sforcetest2.com,(415) 901-7000,The Landmark @ One Market Suite 300,San Francisco,CA,94105,US,2016-12-02T13:45:21.000Z,2016-11-02T13:45:21.000Z
sForceTest3,http://www.sforcetest3.com,(415) 901-7000,1 Market St,San Francisco,CA,94105,US,2016-12-02T13:45:21.000Z,2016-11-02T13:45:21.000Z

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.