Question

I have an application that works without any problem in a spanish server.

When i uploaded the application into the online server (an english windows), im getting exceptions (of type "input string is not a valid Datetime/Int32") with Convert.ToDateTime and Convert.ToInt32. Are any web.config line that could help me in this matter? I tried adding a globalization element with the Spanish culture, but didnt worked.

Could you give me a hand?

Thanks in advance. Josema.

Was it helpful?

Solution

You need:

System.Globalization.CultureInfo culture = 
              new System.Globalization.CultureInfo("es-ES");
DateTime myDateTime = Convert.ToDateTime(string, culture);

OTHER TIPS

Are you specifying a CultureInfo argument, as an IFormatProvider in your String.Format() calls?

You might have set uiculture instead of culture in the globalization element, see: http://msdn.microsoft.com/en-us/library/bz9tc508.aspx.

...
    <globalization culture="es-MX" />
...

You can also try using a more specific culture (like the one above es - mexico).

Ps. I have a site working like that (actually with culture="en" as in my case I needed to force english as my development computer was configured with spanish at the time).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top