这个问题我也碰到过,解决办法2种
1:在客户端用正则把字符串还原成你要的格式,比较麻烦,且效率较低
2:在<%%>中response.write出你的字串,如下
<%
function  printDate(sql)
  dim rs,str,sql
  sql="select date from T"
  set rs =server.createObject("adodb.recordset")
  rs.open sql,conn,1,3
  str=rs(0)
  response.Write("['"&str&"']")
end function
%>
然后在你的js中调用这个函数即可

解决方案 »

  1.   

    sql server 滴 T-SQL 在 convert 为 datetime 时,
    加上第三个参数 120 就是 lz 要滴格式了!
      

  2.   

    CONVERT (data_type[(length)], expression [, style])select date from T改为SELECT CONVERT (DATETIME, [date], 120)
    FROM T
      

  3.   

    写个格式化的函数就是了Date.prototype.format = function(formatString) {
    if(formatString) {
    switch(formatString) {
    case 'date':
    return this.format('Y-M-D');
    case 'time':
    return this.format('H:I:S');
    default:
    var year = this.getFullYear(),month = this.getMonth()+1,day = this.getDate(),hour = this.getHours(),minute = this.getMinutes(),second = this.getSeconds(),time = this.getTime();
    minute = minute<10?'0'+minute:minute;
    second = second<10?'0'+second:second;
    while(rand.length<5) { rand = '0'+rand;}
    return formatString.replace(/Y/g,year).replace(/y/g,year.toString(10).substr(2,2)).replace(/M/g,month<10?('0'+month):month).replace(/m/g,month).replace(/D/g,day<10?('0'+day):day).replace(/d/g,day).replace(/H/g,hour<10?('0'+hour):hour).replace(/h/ig,hour).replace(/i/ig,minute).replace(/s/ig,second).replace(/T/g,time);
    }
    } else {
    return this.toString();
    }
    }
    }
    参数是这样的:
    Y表示 2007
    y表示 07
    M表示 08
    m表示 8
    D表示 01
    d表示 1用的时候这样写  new Date(dateString).format('Y-M-D'),这个dateString就你那个'Wed Aug 22 00:00:00 UTC+0800 2007'
      

  4.   

    上面的把这行去掉 while(rand.length<5) { rand = '0'+rand;}
      

  5.   

    yixianggao(你我他,三人行必有我师焉!) 
    你的办法是行不通的
    首先,我的数据库是access
    其次,我不仅要取日期字段,还有别的字段,而且可能没有日期字段,如果按你的办法,我每次取数据的时候都要判断所有的字段中是否包含日期字段,然后再额外处理,这对于多并发多查询的系统服务器开销太大了