Home
<!DOCTYPE html> <html> <body> <h1>Demo: JavaScript Date Object</h1> <p id="p1"></p> <p id="p2"></p> <p id="p3"></p> <p id="p4"></p> <p id="p5"></p> <p id="p6"></p> <p id="p7"></p> <p id="p8"></p> <p id="p9"></p> <script> var date1 = new Date("February 2015-3"); var date2 = new Date("February-2015-3"); var date3 = new Date("February-2015-3"); var date4 = new Date("February,2015-3"); var date5 = new Date("February,2015,3"); var date6 = new Date("February*2015,3"); var date7 = new Date("February$2015$3"); var date8 = new Date("3-2-2015"); // MM-dd-YYYY var date9 = new Date("3/2/2015"); // MM-dd-YYYY document.getElementById("p1").innerHTML = date1; document.getElementById("p2").innerHTML = date2; document.getElementById("p3").innerHTML = date3; document.getElementById("p4").innerHTML = date4; document.getElementById("p5").innerHTML = date5; document.getElementById("p6").innerHTML = date6; document.getElementById("p7").innerHTML = date7; document.getElementById("p8").innerHTML = date8; document.getElementById("p9").innerHTML = date9; </script> </body> </html>
Result: