从字符串&QUOT转换; 31/03/2012"类型为“日期”是无效的 [英] Conversion from string "31/03/2012" to type 'Date' is not valid

查看:156
本文介绍了从字符串&QUOT转换; 31/03/2012"类型为“日期”是无效的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Web应用程序在ASP vb.net编辑器完美运行。但是,当我通过IIS7运行我的web应用程序,然后我得到这个错误。我失去了在配置IIS7什么?是否有任何人谁可以建议的东西吗?

My web app is running perfectly in asp vb.net editor. But when i run my web app through IIS7 then i get this error. What am i missing in configuring IIS7? Is there anyone who can suggest something?

由于提前

推荐答案

如果您确定的日期始终处于正是格式,那么你可以使用ParseExact代替:

If you are sure that the date is always in exactly that format, then you can use ParseExact instead:

var date = DateTime.ParseExact(
               "31/03/2012",
               "dd/MM/yyyy",
               System.Globalization.CultureInfo.InvariantCulture);

这篇关于从字符串&QUOT转换; 31/03/2012"类型为“日期”是无效的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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