date cast error in asp.net page

R

Robin

In an asp.net page that uses a cast function to convert a date, the code
works in a development environment but in production it displays the
following error.

Cast from string "31/03/2005" to type 'Date' is not valid.

Both are Windows 2003 servers I have check the regional settings which are
both English (United Kingdom).

Are there any other settings that I need to check?
 
M

Mike Craggs

had a similar problem, works on my project with:

System.IFormatProvider format = new
System.Globalization.CultureInfo("en-UK", true);
DateTime.Parse("sting2Parse", format);
 
R

Robin

I found that adding a culture="en-GB" to the globalization part of the
web.config worked.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top