In javascript you can create a Date object from a string, like
var mydate = new Date('2008/05/10 12:08:20');
console.log(mydate); //=> Sat May 10 2008 12:08:20 GMT+0200
Now try this using milliseconds in the string
var mydate = new Date('2008/05/10 12:08:20:551'); // or '2008/05/10 12:08:20.551'
console.log(mydate); //=> NaN
Just out of curiosity: why is this?
EDIT: thanks for your answers, which all offer sufficient explanation. Maybe in some future there will be support for use of milliseconds in date strings. Untill then I cooked up this, which may be of use to somebody:
function dateFromStringWithMilliSeconds(datestr){
var dat = datestr.split(' ')
,timepart = dat[1].split(/:|\./)
,datestr = dat[0]+' '+timepart.slice(0,3).join(':')
,ms = timepart[timepart.length-1] || 0
,date;
date = new Date(datestr);
date.setMilliseconds(ms);
return date;
}