asp跨天时间段如何表示

来源:百度知道 编辑:UC知道 时间:2024/05/25 05:46:09
我想要在数据库中检索今天凌晨2点到第二天凌晨2点的记录,asp中的sql语句该怎么写啊?
日期不是固定的啊,今天就是 2006-12-16 2:00:00 到 2006-12-17 2:00:00,明天就应该变成2006-12-17 2:00:00 到 2006-12-18 2:00:00

select * from 表 where 时间字段>'#2006/12/16 2:00:00#' and 时间字段<'#2006/12/17 2:00:00#'

日期不定,还不好做吗?

t1=date()&" 2:00:00 "
t2=DateAdd("d", 1, t1)
select * from 表 where 时间字段>'#"&t1&"#' and 时间字段<'"&t2&"#'

try:

select * from 表名 where 时间字段>'2006-12-12 2:00:00' and 时间字段<'2006-12-13 2:00:00'