首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

求一段SQL来确定当天的时间范围解决方案

2012-01-21 
求一段SQL来确定当天的时间范围比如:2007-04-2319:04:51.000我就需要2007-04-230:00:00.0002007-04-2323:5

求一段SQL来确定当天的时间范围
比如:

2007-04-23   19:04:51.000

我就需要

2007-04-23   0:00:00.000
2007-04-23   23:59:59.000

来确定是当天的数据,知道的回我一下,谢谢~

[解决办法]
Returns the number of date and time boundaries crossed between two specified dates.
DATEDIFF ( datepart , startdate , enddate )

你使用 DATEDIFF(day, '2007-04-23 19:04:51.000 ', datetimefield) = 0 就可以了

[解决办法]
麻烦
直接看看等不等于convert(varchar(10),getdate(),111)
就行了
[解决办法]
确定是否是当天
convert(varchar,convert(datetime, '2007-04-23 19:04:51.000 '),112) = convert(varchar,getdate(),112)
[解决办法]
DATEDIFF(day, '这里是最后一个时间。。。 ', datetimefield) = 0
或者
DATEDIFF(day, datetimefield, '这里是最后一个时间。。。 ') = 0

热点排行