读书人

SQL日期字符串转JS的时间对象,该如何处

发布时间: 2012-02-02 23:57:14 作者: rapoo

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,"/")) 

读书人网 >JavaScript

热点推荐