问题
I have a string looking like so:
"2013/1/16"
Is there any way I could quickly convert it into date object in javascript, something like:
convertToDateTime("2013/1/16", "yyyy/MM/dd")
回答1:
It's pretty simple:
var myDate = new Date("2013/1/16");
That should do the trick.
Have a look at the documentation for the Date object
来源:https://stackoverflow.com/questions/14197175/convert-string-to-date-in-javascript