日期:2014-05-16  浏览次数:20515 次

SQL日期字符串转JS的时间对象
SQL:convert(varchar(20),stime,120) as stime
把这个stime的字符串放到隐藏标签里,然后JS操作如下:
var stime2=new String(document.form1.stime.value)
var stime=new Date(stime2)
但是提示stime为NaN
请问我该怎么把这个SQL的字符串转变为JS的时间对象


------解决方案--------------------
try
JScript code

var stime2=new String(document.form1.stime.value)
var stime=new Date(stime2.replace(/[-]/g,"/"))