简体   繁体   English

ASP.NET MVC RSS提要日期时间格式

[英]ASP.NET MVC RSS feed datetime format

如何获得RSS feed的这种日期时间格式?

Mon, 06 Sep 2009 16:45:00 +0000

I think you want DateTime.Now.ToString("r") , 我认为您想要DateTime.Now.ToString("r")
where the 'r' indicates formatting following the RFC1123 pattern. 其中,“ r”表示遵循RFC1123模式的格式。

It will not (always) display an offset as +000, it will use 'GMT' and other standardized tz names. 它不会(始终)显示偏移量为+000,而是使用“ GMT”和其他标准化的tz名称。

As far as I can tell this one of the rare case where you don't have to specify an IFromatProvider. 据我所知,这是一种罕见的情况,您不必指定IFromatProvider。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM