Timeline for How to resolve the Invalid Date error in Apex while uploading CSV file?
Current License: CC BY-SA 3.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 23, 2013 at 6:55 | comment | added | Arun | @ITMANHAH, Can you please explain more about the excel formula. | |
Jul 23, 2013 at 6:54 | comment | added | Arun | Thank you all for the valuable inputs. From all your inputs I came to know that this will be a file format issue so we cannot have any generic code to resolve this error. | |
Jul 23, 2013 at 5:34 | comment | added | ITMANHAH | Excel might display the date as dd/mm/yyyy but that is a bit like SF displaying dates and times in the locale of the user. I overcame this by constructing a textstring using an excel formula and then used that. | |
Jul 22, 2013 at 19:27 | comment | added | Daniel Ballinger | @Arun, It would appear that your local UTF-8 CSV files are not in the format you expected, as 5/31/2014 would not be a valid date in the en_AU locale. I don't think you can have generic code to handle this. Even if you caught the TypeException and tried an alternative parsing method, you need to know the date format used to be consistent with all the data. | |
Jul 22, 2013 at 16:12 | comment | added | cropredy | Go to your CSV files and examine them in Notepad - look at how the dates are saved in the files. Your APEX code will have to be written to be sufficiently flexible to handle all variations. There is no one single APEX Date method that will parse all formats. | |
Jul 22, 2013 at 10:31 | comment | added | Arun | Thanks for some useful information. My CSV file date format is DD/MM/YYYY and my organization date format also the same. My organization default locale English (Australia). When I am trying to upload the CSV file which is generated by Google drive is working fine as per my requirement but other local UTF-8 CSV files are giving the Invalid Date error. Can u pls give me some permanent solution for this. | |
Jul 22, 2013 at 10:16 | history | edited | Daniel Ballinger | CC BY-SA 3.0 |
added 349 characters in body
|
Jul 22, 2013 at 10:08 | history | answered | Daniel Ballinger | CC BY-SA 3.0 |