javascript - Unable to create Date from string in Safari -
i want create js date object given string.
stringformat: yyyy,mm,dd
script:
var odate = new date('2013,10,07'); console.log(odate);
in chrome, ie , ff right date, safari nan
.
you can use date
constructor:
new date(year, month, day, hours, minutes, seconds, milliseconds)
you can fix problem this:
var s='2013,10,07'; var = s.split(','); var date = new date(a[0],a[1]-1,a[2]);
but must sure date format same in sample.
Comments
Post a Comment