Date.parse error
I'm trying to store a retrieved date d=string (from an rss feed) as a date object, but can't get past the Date.parse function.
Every example and test I try in regular browsers works:
d = Date.parse('2010-04-07T21:21:22+00:00')
(frankly, many differently formatted dates I try work in the browser, but not in the iphone…) I invariably get 'NaN' from the iphone version…
Anyone else struggling with Date issues?
1 Answer
-
I struggled for a little while with dates as well, and found the following to work well for me:
var myDate = new Date(dateString.replace(/-/g, '/'));
I had to replace "-" characters with "/", and was just using the Date() constructor, but I believe Date.parse() is the equivalent.