Reputation: 566
I'm importing a csv file and one of columns is a date, but it comes with this format:
date;
03 FEV;
03 FEV;
05 FEV;
07 FEV;
Which format is this? How to convert it to?
yyyy-mm-dd h:mm:ss
Thanks!
Upvotes: 0
Views: 76
Reputation: 9804
A date that only is "3rd Feburary" can only tell you that much. A DateTime will have to use something for the year and time, propably some default values. Keep that in mind. Also this is all asuming the Portugese Language - Brazilian Format. THe exact number formating can varry drastically, with few examples as clasical as en-US vs en-GB.
//Get the culture information you will need
CultureInfo cultureFormat = CultureInfo.GetCultureInfo("pt-BR");
//Now let us try to Prase this
string input = "03 FEV";
DateTime output = DateTime.Parse(input, cultureFormat);
Upvotes: 1