4
I have a string "sex, nov 6"
and need to convert to DateTime
.
I’m doing it this way:
DateTime datetime =
DateTime.Parse(gridT.Columns[e.ColumnIndex].HeaderText.ToString());
But it’s not working.
How can I make this conversion?
4
I have a string "sex, nov 6"
and need to convert to DateTime
.
I’m doing it this way:
DateTime datetime =
DateTime.Parse(gridT.Columns[e.ColumnIndex].HeaderText.ToString());
But it’s not working.
How can I make this conversion?
7
You need to do the exact conversion, but if the date is not in the expected format, chipped:
DateTime.ParseExact("sex, nov 6", "ddd, MMM d", new CultureInfo("pt-BR"))
Behold working in the ideone. And in the .NET Fiddle. Also put on the Github for future reference.
Very good, works right.
Thank you so much
Browser other questions tagged c# .net string datetime conversion
You are not signed in. Login or sign up in order to post.
how you load the date in gridT?
– Marco Souza