
asp读取access数据库里日期字段的问题,请高手帮忙
现在想在首页调用新闻时,让每条新闻后面所带的更新时间格式变成2006-12-25的格式,可是现在全部显示2006-12-2512:25:35很郁闷不知道怎么编写,请高手帮...
现在想在首页调用新闻时,让每条新闻后面所带的更新时间格式变成 2006-12-25 的格式,可是现在全部显示2006-12-25 12:25:35很郁闷不知道怎么编写,请高手帮忙改一下啊!
这是我的代码
<%
set rst=server.createobject("adodb.recordset")
sql2="select top 7 * from hylszyls order by id DESC"
rst.open sql2,conn,3,3
if rst.eof then
response.write "暂且没有新闻信息"
else
do while not rst.eof %>
<table width="98%" height="25" border="0" cellpadding="0" cellspacing="0" class="xia">
<tr>
<td width="10%" height="20" align="center" valign="middle"><span class="ddyyCopy"><img src="images/a5.jpg" width="11" height="11">
</span>
</td>
<td><a href='pic.asp?id=<%=rst("id")%>' class='ddyyCopy' target='_blank'><%=rst("mc")%></a></td>
<td width="23%"><a title="<%=rst("addtime")%>" class="hd"><font color=#FF9900><%=rst("addtime")%></font></a></td>
</tr>
</table>
<%rst.movenext
loop
end if
rst.close
set rst=nothing
%>
addtime是时间 展开
这是我的代码
<%
set rst=server.createobject("adodb.recordset")
sql2="select top 7 * from hylszyls order by id DESC"
rst.open sql2,conn,3,3
if rst.eof then
response.write "暂且没有新闻信息"
else
do while not rst.eof %>
<table width="98%" height="25" border="0" cellpadding="0" cellspacing="0" class="xia">
<tr>
<td width="10%" height="20" align="center" valign="middle"><span class="ddyyCopy"><img src="images/a5.jpg" width="11" height="11">
</span>
</td>
<td><a href='pic.asp?id=<%=rst("id")%>' class='ddyyCopy' target='_blank'><%=rst("mc")%></a></td>
<td width="23%"><a title="<%=rst("addtime")%>" class="hd"><font color=#FF9900><%=rst("addtime")%></font></a></td>
</tr>
</table>
<%rst.movenext
loop
end if
rst.close
set rst=nothing
%>
addtime是时间 展开
2个回答
展开全部
将:
<td width="23%"><a title="<%=rst("addtime")%>" class="hd"><font color=#FF9900><%=rst("addtime")%></font></a></td>
变为:
<td width="23%"><a title="<%=rst("addtime")%>" class="hd">
<font color=#FF9900>
<%=FORMATDATETIME(rst("addtime"),vbShortDate)%>
</font></a></td>
就可以了。
<td width="23%"><a title="<%=rst("addtime")%>" class="hd"><font color=#FF9900><%=rst("addtime")%></font></a></td>
变为:
<td width="23%"><a title="<%=rst("addtime")%>" class="hd">
<font color=#FF9900>
<%=FORMATDATETIME(rst("addtime"),vbShortDate)%>
</font></a></td>
就可以了。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询