Rss feed 的日期转换
我正在尝试聚合多个 rss feed,当我尝试转换从 feedd 获得的发布日期时,出现异常,因为日期采用以下格式 “英国夏令时 2010 年 5 月 5 日星期三 14:27:37”
。
我尝试使用我在此处找到的代码片段转换为 Rfc822 日期时间,但它仍然无法工作(出于明显的原因)。有谁知道如何将其转换为 .Net 中的 DateTime 对象
I am trying to aggregate several rss feeds and when I try to convert the publish date I get from the feedds, I get an exception as the date is in the following format'Wed, 5 May 2010 14:27:37 BST'
.
I have tried converting to Rfc822 datetime using a code snippet I found here but it still won't work (for obviousreasons). Does anyone know how I can convert this to a DateTime object in .Net
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我写了一个小片段,不支持所有格式,但支持很多格式。我很高兴收到反馈或改进...
I wrote a little snippet, not supporting all formats, but many. I would be happy to receive feedback or improvements...
时间中的“BST”是指英国夏令时间、巴西标准时间或白令夏令时间。如果您知道时间被“编码”的时区,您可以获取它来解析它。我在样本中假设了英国夏令时间:
只需从时间字符串末尾“删除”单词“BST”并获取英国文化信息来解析日期和时间。
"BST" in time means British Summer Time, Brazil Standard Time or Bering Summer Time. If you know the time zone in which the time was "encoded" you can get it for parsing it. I assumed British Summer Time in my sample:
Just "kill" the Word "BST" from end of the time string and get Britsh culture info to parese the date and time.