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")
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")
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
var myDate = new Date("2013/1/16");
var str = "2013/1/16"; var strToDate = new Date(str);