0

I'm reading from a RSS feed which outputs date/time in the following format:

Day, DD Mon YYYY HH:MM:SS OFFSET

For example,

Tue, 24 Apr 2012 08:15:00 -0700

Using JavaScript,I need to convert it to an ISO8601 string (via Date.toISOString() preferably).

Any assistance would be appreciated.

I haven't really worked with time in JS before, so I haven't got many ideas. Would it be possible to switch the offset to a time zone, and convert it as a JS Date object?

4

1 に答える 1

1

u can do that with the date object (at least it is working for me in chrome)

var test = new Date("Tue, 24 Apr 2012 08:15:00 -0700");
test.toISOString() // "2012-04-24T15:15:00.000Z"

I hope it is the correct output... not sure

于 2012-04-24T16:43:09.330 に答える