0

I am getting an error of invalid date when I am sending a csv through an email service. Here is the snippet of my code.

if (csvAsStringRowElement.size() > 0 && csvAsStringRowElement[4] != null && csvAsStringRowElement[4].trim().length() > 0) {

Date dat = Date.parse(csvAsStringRowElement[4]);
system.debug('dat-->'+dat);

}
0

You have to convert the datetime to the following format:-

2017-01-01T23:01:01Z

Also refer to the following link for more on date formats :- https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_dateformats.htm

| improve this answer | |
  • It's a normal date field and the document you have referred does not exist – manchesterunited Aug 17 '17 at 5:46
  • @manchesterunited Can u plz check once again the URL and compare the format . Also just to confirm try to enter the same date in the same format manually using workbench. – cloudy-ritz Aug 17 '17 at 6:01

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.