问题在asp.net Convert.ToDateTime [英] Problem with Convert.ToDateTime in asp.net

查看:182
本文介绍了问题在asp.net Convert.ToDateTime的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有没有任何问题在西班牙服务器工作的应用程序。

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

当我上载应用到在线服务器(英文Windows),即时得到异常(类型输入字符串是不是有效的datetime /的Int32)与Convert.ToDateTime和Convert.ToInt32。是否有任何的web.config线,可以帮助我在这件事情?我尝试添加一个全球化的元素与西班牙的文化,但没有奏效。

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.

您能帮我个忙吗?

在此先感谢。
Josema。

Thanks in advance. Josema.

推荐答案

您需要:

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

这篇关于问题在asp.net Convert.ToDateTime的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆