Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Could not determine the order of year, month, and date from '"dd/MM/yyyy"'
LCotts
#1 Posted : Monday, February 16, 2009 4:18:35 AM(UTC)
Groups: Member
Joined: 2/16/2009(UTC)
Posts: 1
Location: UK

Hi All,

Hopefully I am being dumb here, I have tried a few alternatives and all come to the same result.

In our application there are certain fields that allow a user to type in a date (which we check for validity) that is used within a calculation. When I host the application either withing Visual Studio or IIS it works fine with either of the following code:

Code:

DateTime.Parse("20/07/1978");


or
Code:


DateTime parsedDate;
DateTime.TryParse("20/07/1978", out parsedDate);


or indeed

Code:

Convert.ToDateTime("20/07/1978"));


But whenever I run even your sample app and add the following a line of code in like the one below for instance:

Code:

this.Label1.Text += string.Format("Converted Date To: {0}", DateTime.Parse("20/07/1978"));


I get the following error:
Quote:
Server Error in '/' Application.


Could not determine the order of year, month, and date from '"dd/MM/yyyy"'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.FormatException: Could not determine the order of year, month, and date from '"dd/MM/yyyy"'.

Source Error:


Line 14: {
Line 15: this.Label1.Text = string.Format("Page served by: {0}", this.Request.ServerVariables["SERVER_SOFTWARE"]);
Line 16: this.Label1.Text += string.Format("Converted Date To: {0}", DateTime.Parse("20/07/1978"));
Line 17: //this.Label1.Text += string.Format("Converted Date To: {0}", Convert.ToDateTime("20/07/1978"));
Line 18: }



I have tried putting the following in the web.config:

Code:

<globalization culture="en-GB" uiCulture="en-GB" requestEncoding="utf-8" responseEncoding="utf-8" />


To force the system to use UK culture for the formatting but I still get the same error.

Can anyone point me in the right direction, is there something blatantly obvious that I am missing?

Best wishes

Lee
Ultidev Team
#2 Posted : Monday, February 16, 2009 5:29:00 AM(UTC)
Ultidev Team

Groups: Administration
Joined: 11/3/2005(UTC)
Posts: 2,253

Thanks: 28 times
Was thanked: 60 time(s) in 59 post(s)
Hi there!

We were able to reproduce this issue in Visual Studio dev web server, so this issue does not seem to be UltiDev Cassini-specific. You may want to check Microsoft support sites http://www.asp.net and MSDN Forums.

Best regards,
UltiDev Team.
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
Rss Feed  Atom Feed
Users browsing this topic
Guest (2)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You can vote in polls in this forum.