大佬教程收集整理的这篇文章主要介绍了c# – 将日期格式解析为特定文化,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
public class UserInfoModel { public datetiR_183_11845@e DateOfBirth{get;set;} // some other properties here }
当用户输入日期即:04/15/1981时,我在邮寄方法中的日期时间是1981年4月15日,但是,当插入以下日期时,在返回的模型中,DateOfBirth属性为null
有没有办法可以改变全局解析日期的方式(在我的应用程序中)
<system.web> <globalization culture="en-ZA" uiCulture="en-ZA"/> </system.web>
但它似乎没有什么区别.
protected void Application_Beginrequest(object sender,EventArgs E) { CultureInfo cInfo = new CultureInfo("en-ZA"); cInfo.datetiR_183_11845@eFormat.ShortDatePattern = "dd-MM-yyyy"; cInfo.datetiR_183_11845@eFormat.DateSeparator = "/"; Thread.CurrentThread.CurrentCulture = cInfo; Thread.CurrentThread.CurrentUICulture = cInfo; }
以上是大佬教程为你收集整理的c# – 将日期格式解析为特定文化全部内容,希望文章能够帮你解决c# – 将日期格式解析为特定文化所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。