asp中输出数据库时间

来源:百度知道 编辑:UC知道 时间:2024/05/30 03:06:19
比如:
for(var i=0;i<M.rs.PageSize;i++){
if(!rs.EOF){
Response.Write("• "+rs("标题")+"<span>"+rs("时间")+"</span><br>"); //必须有Value,也可以是rs(1).Value ,rs(0)表示打开数据表的第一列
//Response.Write("<span>")
//Response.Write(rs(3));
//Response.Write("</span><br>");
M.rs.MoveNext();
}
输出时间:Sat Jun 6 10:55:48 UTC+0800 2009

怎样变成:2009-6-10 10:55:48

谢谢
这儿我是用javascript编写的asp,服务器在网通啊,我只能通过客户端来修改的

应该修改服务器时间格式吧!

修改服务器的时间格式

你只能 把年月日 分别取出来 然后再组合成字符串输出
getday getyear 如果我没记错是这样的函数 你找找 能找到

function dateFMT(d){
return d.getYear()+"-"+d.getMonth()+"-"d.getDay()+" "+d.getHours()+":"+d.getMinutes()+":"+d.getSeconds();
}

Response.Write(dateFMT(rs("时间")));

<%
TimeTmp = Rs("时间")
TimeTmp = Year(TimeTmp)&"-"&Month(TimeTmp)&"-"&Day(TimeTmp)&"-"&" "&Hour(TimeTmp)&":"&Minute(TimeTmp)&":"&Second(TimeTmp)
Response.Write(TimeTmp)
%>