您的位置:程序门 -> web 开发 -> asp



数据库查询的时间怎么了当前时间作比较


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


数据库查询的时间怎么了当前时间作比较[已结贴,结贴人:lijuan33828]
发表于:2007-04-17 14:18:31 楼主
使用语言:asp
数据库:sql   server
发表于:2007-04-17 14:20:101楼 得分:0
哪位大侠帮帮忙了
发表于:2007-04-17 14:34:312楼 得分:30
用datediff()函数
如:if   datediff( "d ",数据库时间,date())> 0   then  
              response.write   "在当前日期之前 "
        end   if
发表于:2007-04-17 16:20:453楼 得分:0
<!--#include   file= "conn.asp "-->
<!--#include   file= "sys.asp "-->
<form   action= "cpview.asp ">
<%
set   rs=server.createobject( "adodb.recordset ")
sql= "select   jssj   from   product "
'sql= "update   product   set   jssj= "(jssj) " "
rs.open   sql,conn,1,3
if   rs.eof   or   rs.bof   then
%>
                <%
dd=rs( "jssj ")
ssecond=datediff( "s ",now,dd)
%>

<script   src= "images/showtime.js "   type=text/javascript> </script>
<script   language= "javascript ">
showtime( "jssj ", <%=ssecond%> ,1);
</script>
<%
if   datediff( "dd ",jssj(nowtime,2),nowdate)> 0   then
                    response.write( "大于当前时间 ")
        else
        ok=rs( "jssj ")
if   ok   <dd   then
        response.write   ok
else
        response.write   "dd "
end   if
    end   if
rs.close
  set   rs=nothing
  end   if
                %>
<%=rs( "jssj ")%> <br>
<%=now()%> <br>
<input   type= "text "   name= "jssj ">
<input   type= "submit "   name= "submit ">
</form>

大侠帮我修改一下
发表于:2007-04-17 16:25:594楼 得分:30

sql= "select   *   from   tabel   where   datediff(d,datetime1,date())> =0 "
当前时间之前
发表于:2007-04-17 16:32:195楼 得分:0
直接改sql语句,别的不用修改吗?
发表于:2007-04-17 19:14:396楼 得分:40
直接用sql语句就可以,当前时间在sql里用now就行


快速检索

最新资讯
热门点击