源代码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>享学课堂</title> </head> <body> <p>Date.parse(string) 返回毫秒.</p> <p>可以使用返回值将字符串转换为日期对象:</p> <p id="demo"></p> <script> var msec = Date.parse("March 21, 2012"); var d = new Date(msec); document.getElementById("demo").innerHTML = d; </script> </body> </html>
运行结果