G
Guest
Hi.
Does anyone know if there is a know bug in DateTime.ParseExact that makes it
unable to read DateTime-formatted strings using the same format and culture
parameters?
The following code will ilustrate my problem:
using System;
using System.Globalization;
using System.Text;
namespace DateTimeSample
{
class Program
{
static void Main(string[] args)
{
String format = "ddMMMyyy HH:mm";
IFormatProvider provider = CultureInfo.CurrentCulture;
//en-GB here
String text = DateTime.Now.ToString(format, provider);
//text=18May2006 15:24
DateTime dt = DateTime.ParseExact(text, format, provider);
//Exception {"String was not recognized as a valid DateTime."}
}
}
}
If so - is there a good workaround for this particular format (assuming
CurrentCulture changes, it is used in an international application).
I looked through
http://lab.msdn.microsoft.com/produ...createdWithin=&submissionlang=0&productlang=0 but none of the bugreports matches my problem.
Does anyone know if there is a know bug in DateTime.ParseExact that makes it
unable to read DateTime-formatted strings using the same format and culture
parameters?
The following code will ilustrate my problem:
using System;
using System.Globalization;
using System.Text;
namespace DateTimeSample
{
class Program
{
static void Main(string[] args)
{
String format = "ddMMMyyy HH:mm";
IFormatProvider provider = CultureInfo.CurrentCulture;
//en-GB here
String text = DateTime.Now.ToString(format, provider);
//text=18May2006 15:24
DateTime dt = DateTime.ParseExact(text, format, provider);
//Exception {"String was not recognized as a valid DateTime."}
}
}
}
If so - is there a good workaround for this particular format (assuming
CurrentCulture changes, it is used in an international application).
I looked through
http://lab.msdn.microsoft.com/produ...createdWithin=&submissionlang=0&productlang=0 but none of the bugreports matches my problem.