I'm trying to get JavaScript to parse a date and time format for me, with the eventual aim of telling me the days passed since that date and the time right now (locally).
Unfortunately, the date format I have to work with (it's from a JSON response which I don't have control over) is returning it in 2008-10-01 06:21:43 type format.
var thedate = "2008-10-01 06:21:43";
var inmillisecs = new Date(thedate);
This just returns an error from JavaScript telling me the date is invalid.
How do I get around this issue?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…