0

使用 Google Feed API JSON 结果时,原始 RSS 将在 JSON 结果中转换一天。

例如以下原始 RSS 条目:

<pubDate>Mon, 19 Aug 2013 04:00:00 GMT</pubDate>

...变成:

"Sun, 18 Aug 2013 21:00:00 -0700"

...在 JSON 结果中。有没有办法指定一个时区,所以它知道不转换?

提前致谢!

4

1 回答 1

1

There is no 'wrong day' in your question, both date strings are equivalent, just in different timezones. In your Javascript you can just construct a Date object from either one and then use the Date methods like either toLocaleString or toUTCString to represent it locally however you want it to.

Here's a sample Fiddle to play with.

于 2013-08-19T22:58:09.837 回答