将应用程序发布到 IIS 时,如何在 MVC 中使用 dd/mm/yyy 格式绑定日期时间?
How to bind datetime with format dd/mm/yyy in MVC when publish Application to IIS ?
其实我的问题很简单,但我不知道如何解决。
我有一个 ActionResult
方法 return View
并采用 datetime
属性所以我在 ActionLink
中发送 datetime
属性像这样
@Html.ActionLink("ForignSell", "ForignSell", "Reports", new {Start =@ImpDate.DateConfig},null)
ImpDate.DateConfig
是我发送到 Action
的日期,当我 运行 在本地模式下 datetime
绑定了这种格式 dd/MM/YYY
有没问题直到现在当我在 IIS 中发布它时问题就来了,datetime
绑定了这种格式 MM/DD/YYY
这对我来说是个问题有人知道为什么吗以不同的方式绑定?
将日期对象转换为您想要的字符串格式:
@Html.ActionLink("ForignSell", "ForignSell", "Reports", new {Start = @ImpDate.DateConfig.ToString("dd/MM/yyy")}, null)
ActionLink 助手将自动url 编码路由数据。
其实我的问题很简单,但我不知道如何解决。
我有一个 ActionResult
方法 return View
并采用 datetime
属性所以我在 ActionLink
中发送 datetime
属性像这样
@Html.ActionLink("ForignSell", "ForignSell", "Reports", new {Start =@ImpDate.DateConfig},null)
ImpDate.DateConfig
是我发送到 Action
的日期,当我 运行 在本地模式下 datetime
绑定了这种格式 dd/MM/YYY
有没问题直到现在当我在 IIS 中发布它时问题就来了,datetime
绑定了这种格式 MM/DD/YYY
这对我来说是个问题有人知道为什么吗以不同的方式绑定?
将日期对象转换为您想要的字符串格式:
@Html.ActionLink("ForignSell", "ForignSell", "Reports", new {Start = @ImpDate.DateConfig.ToString("dd/MM/yyy")}, null)
ActionLink 助手将自动url 编码路由数据。