--判断2个日期间的,年月日间隔 --举例如下: 2017-12-31~2018-01-01 = 2天 2017-01-01~2018-12-31 = 2年 2017-01-01~2018-01-01 = 1年1天 2017-06-06~2018-01-01 = 6月27天 2015-09-10~2018-10-14 = 3年1月5天 2015-09-10~2018-08-14 = 2年11月5天
2023-03-02 20:10:27 2KB datediff
1
DATEPART() 函数用于返回日期/时间的单独部分,比如年、月、日、小时、分钟等等。 DATEDIFF() 函数返回两个日期之间的时间差。 --查找当天上午的数据 select * from R_Attendance where (datepart(hour,RDatetime)>=0 and datepart(hour,RDatetime)<12 datediff(d,RDatetime,GetDate())=0>12 and d
2022-09-22 11:26:46 37KB ar art date
1