关于时间的问题~!!

wqllegend 2005-11-02 07:50:08
从键盘输入time1,time2然后查询
符合 time1以后 和 time2之前的 记录 显示出来 怎样实现这个条件
select ??????where ??????????????
...全文
94 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
jspadmin 2005-11-02
  • 打赏
  • 举报
回复
#是access里日期常量符号
----------------------------------------------------------------------------------
欢迎光临我的小站(提供免费博客申请):http://www.pifoo.com
wqllegend 2005-11-02
  • 打赏
  • 举报
回复
怎么这么多格式 加上##是什么意思?
hongzi001179 2005-11-02
  • 打赏
  • 举报
回复
select * from t1 where inputdate between #"&time1&"# and #"&time2&"#
up1002 2005-11-02
  • 打赏
  • 举报
回复
如果是两个日期,要注意是否“含”的问题。
例如 time1 是 2005-10-01,time2是 2005-10-31
如果用 select * from t1 where inputdate between '"&time1&"' and '"&time2&"'"
则取得是 2005-10-01 00:00:00 至 2005-10-31 00:00:00 的,
而不包括 2005-10-31 全天的。

所以,如果time1和time2是日期,则需要
time1=CDate(time1&" 00:00:00.000")
time2=CDate(time2&" 23:59:59.999")
lonaerd 2005-11-02
  • 打赏
  • 举报
回复
select * from t1 where inputdate between '"&time1&"' and '"&time2&"'"
或者
select * from t1 where (inputdate >'"&time1&"' and inputdate<'"&time2&"')"

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧