markknowsley
Programmer
Please can someone help because this is driving me nuts. I've got three text boxes which take date in the format dd/mm/yyyy. I check to see that all the inputs are numeric, then parse the date thus:
if ((v.IsNumeric(txtDay.Text) == true) && (v.IsNumeric(txtMonth.Text) == true) && (v.IsNumeric(txtYear.Text) == true))
{
CultureInfo ukCulture = new CultureInfo("en-GB");
DateTime dtDateTime = DateTime.Parse(txtDay.Text + "/" + txtMonth.Text + "/" + txtYear.Text, ukCulture.DateTimeFormat);
}
On the local VS 2005 web server this works fine. But as soon as I copy the web form to an IIS web server and enter a date like 31/01/2006 I get the following error message:
"String was not recognized as a valid DateTime"
I thought that the 'en-GB' culture was supposed to stop this happening - any ideas?
if ((v.IsNumeric(txtDay.Text) == true) && (v.IsNumeric(txtMonth.Text) == true) && (v.IsNumeric(txtYear.Text) == true))
{
CultureInfo ukCulture = new CultureInfo("en-GB");
DateTime dtDateTime = DateTime.Parse(txtDay.Text + "/" + txtMonth.Text + "/" + txtYear.Text, ukCulture.DateTimeFormat);
}
On the local VS 2005 web server this works fine. But as soon as I copy the web form to an IIS web server and enter a date like 31/01/2006 I get the following error message:
"String was not recognized as a valid DateTime"
I thought that the 'en-GB' culture was supposed to stop this happening - any ideas?