So I have to take these date and time values from a csv file and I have to change them into “dd/MM/yyyy” format in order to be able to use it to compare values with another datatable.
So for example:
4/5/2022 becomes 04/05/2022, and
18/2/2022 becomes 18/02/2022 and
7/11/2022 becomes 07/11/2022. (and so on)
The thing is, for some reason if the day or month date have double digits, it instantly cannot recognise it anymore. I tried TryParseExact, Parse, ParseExact and they all give the same error. It was able to parse normally with Date1, but not the rest as you can see. Does anyone have any idea what might be the issue?
Are you sure if the date is as in the above format ?
I suppose so? This was just a hacky way of quickly testing if they would work, but yes, the format is consistently as you can see in the default values. Here’s some more example:
I just noticed that in the excel preview it shows with AM/PM, so I tested out with values just from the table itself (like what you see in the picture above) instead of the text editor in the excel, but same error pops up. This is what I’m talking about by the way.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.