Converting String to date

  • Thread starter Thread starter Joris De Groote
  • Start date Start date
J

Joris De Groote

Hi,

I have a date: "7/10/2006"
I convert it with this: Convert.ToDateTime(DocumentDatum)
Now I get this: "10/7/2006"
How can I make sure that it doesn't change month & day?

Thanks
Joris
 
Here's one way
Debug.WriteLine(Convert.ToDateTime("12/3/2006", New
Globalization.CultureInfo("en-GB")).ToShortDateString)
 
Joris De Groote said:
I have a date: "7/10/2006"
I convert it with this: Convert.ToDateTime(DocumentDatum)
Now I get this: "10/7/2006"
How can I make sure that it doesn't change month & day?

Check out 'DateTime.ParseExact'.
 
Back
Top