Problem with Convert.ToDateTime in asp.net

依然范特西╮ 提交于 2019-12-04 20:04:40

You need:

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

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).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!