DateTime exception due to milliseconds field #1938
-
Hi there. When reading data from a csv file, I get an exception error whenever I add milliseconds to DateTime. I'm able to manipulate fields formatted like "dd/MM/yyyy HH:mm:ss", although when I add milliseconds to it ("dd/MM/yyyy HH:mm:ss.fff"), This is an example of the exception message: "... (supressed) Inner Exception I'm not sure why this only happens if I add the milliseconds. Could anyone shed some light, please? Is there any configuration changes I should be doing? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Found an answer. Just sharing with anyone interested in the future. It was quite simple and I basically added the following option: csvReader.Context.TypeConverterOptionsCache.GetOptions().Formats = new[] { "dd/MM/yyyy HH:mm:ss.fff" }; |
Beta Was this translation helpful? Give feedback.
Found an answer. Just sharing with anyone interested in the future. It was quite simple and I basically added the following option:
csvReader.Context.TypeConverterOptionsCache.GetOptions().Formats = new[] { "dd/MM/yyyy HH:mm:ss.fff" };