字符串到日期时间转换javascript

Dee*_*Dee 5 javascript

如何使用java脚本将字符串(2010年4月9日)转换为日期时间(2010年4月9日00:00:00)?我需要比较验证的日期.

use*_*291 17

看看Date.parse

str = "09-Apr-2010"
date = new Date(Date.parse(str.replace(/-/g, " ")))
alert(date.toLocaleString())
Run Code Online (Sandbox Code Playgroud)