MVC 4.0和日期格式 [英] MVC 4.0 and date formate

查看:67
本文介绍了MVC 4.0和日期格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我们可以在MVC 4.0中的cshtml文件中更改日期格式吗?

如果是,那么我们如何更改日期结婚到 dd MMMM yyyy(2014年8月1日)

请建议。



谢谢你,



问候,

Ashish

Hi,

Can we change date formate in cshtml file in MVC 4.0?
If yes then how can we change the date formate to dd MMMM yyyy(01 Aug 2014).
Please suggest.

Thank you,

Regards,
Ashish

推荐答案

你可以编码为

you can code as
@DateTime.Now.ToString("dd MMM yyyy")











or

@Convert.ToDateTime("01-09-2014").ToString("dd MMM yyyy")


item.lastUpdate.ToString("dd MMM yyyy")

How about below line

@Html.DisplayFor(m=>m.lastUpdate).ToString("dd MMM yyyy"))


这篇关于MVC 4.0和日期格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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