Today I got a really strange problem.
Try to execute this C# code:
class Program
{
static void Main(string[] args)
{
string yesterdayString = (DateTime.Now - TimeSpan.FromDays(1)).ToString("R");
string nowString = DateTime.Now.ToString("R");
DateTime.Parse(yesterdayString);
DateTime.Parse(nowString);
DateTime.Parse("Wed, 29 Feb 2012 18:05:49 GMT"); // this is what i have in yesterdayString
DateTime.Parse("Thu, 01 Mar 2012 18:05:40 GMT"); // this is what i have in nowString
}
}
Of course you will get the problem just for today. I’ve added the last two commands to let you know what the problem is.
Tomorrow and throughout the month of March DateTime.Parse will throw a FormatException (String was not recognized as a valid DateTime.)
Why?
I would say you found a bug. This should work:
or for Italian it still throws…