创建有效的 rss 日期
我想将日期转换
Sat Dec 31 22:42:58 CET 2011
为有效的 rss 日期,通常看起来
Mon, 06 Sep 2009 16:45:00 +0000
秒应该始终为 00
。有办法这样做吗?此外,还可以找出当前的有效 rss,但这是可选的;)
I want to convert a date like
Sat Dec 31 22:42:58 CET 2011
to a valid rss date which normaly looks like
Mon, 06 Sep 2009 16:45:00 +0000
Seconds should always be 00
. Is there anyway to do so? Besides it would be could to find out the current as a valid rss but that's optional ;)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
更新
使用新的示例输入,您甚至不需要重新格式化。它很简单,
技巧是将日期重新格式化为
date
可以理解并作为输入的字符串。在本例中为2011-12-31 13:37
。我使用 awk 来执行此操作,但有许多不同的实用程序就足够了。输出
Update
With your new sample input, you don't even need to reformat. It's as simple as
The trick is to reformat your date into a string that
date
can understand and take as input. In this case it is2011-12-31 13:37
. I'm usingawk
to do this, but there are number of different utilities that will suffice.Output