注册 登录
编程论坛 J2EE论坛

关于数据库时间问题

心动音符 发布于 2007-08-21 19:32, 725 次点击

数据库中有表 table 时间列为date类型是(datetime)型 如何选取当天的数据用sql写

9 回复
#2
无缘今生2007-08-21 23:33
什么意思啊?没看明白。
#3
心动音符2007-08-22 08:15
就是说 有一个表 表名叫table 里有一列叫date 它的类型是(datetime型)
我现在想从这张表中取出 date列为当日时间的所有记录
明白?
#4
sea72007-08-22 08:19

new timestamp(System.currentTimeMillis)应该可以

#5
小邱2007-08-23 14:02

可以用模糊查询获取,select * from [table] where [date] like convert(char(10),getdate(),21)+'%'具体不知道获取当天日期(具体到天)有没问题,大致就是这个意思拉。

#6
cssky2007-08-23 20:32
select * from [table] where [date] like datadiff(day,convert(varch(10),getDate()),[date])=0
大概是这意思吧.好久没有用SQL了,你查下帮助吧!
#7
sailyyang2007-08-27 13:57
date now
#8
chaiwp2007-08-27 17:10

#9
chaiwp2007-08-27 17:10
#10
tiantiaqn2007-08-28 09:49
可以有当前系统时间去与数据表中的时间匹配
定义一个resultSet
1