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

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

php - Accessing static methods using newly created $obj or using class Name -