How do I use DateTime.Parse or DateTime.ParseExact to create a
DateTime object from a string?
I tried this without luck:
string dateString = "27-02-2007";
// DateTime dt = DateTime.Parse(dateString);
// Throws a FormatException exception
IFormatProvider culture = new CultureInfo("fr-FR", true);
DateTime dt = DateTime.ParseExact(dateString, "dd-mm-yyyy", culture);
Console.WriteLine(dt);
output shows : 1/27/2007 0:02:00
Which is not what I expect..
Lars
Rad [Visual C# MVP] - 28 Feb 2007 19:35 GMT
> How do I use DateTime.Parse or DateTime.ParseExact to create a
> DateTime object from a string?
[quoted text clipped - 12 lines]
>
> Lars
Check your cases! m is the format string for minutes. What you want to use
is MM

Signature
Bits.Bytes
http://bytes.thinkersroom.com