当前位置: 代码迷 >> JavaScript >> SQL日期字符串转JS的时间对象,该如何处理
  详细解决方案

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

热度:807   发布时间:2012-02-02 23:57:14.0
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,"/")) 
  相关解决方案