declare @aa datetime
declare @bb datetime
SET @aa=GETDATE()
print @aa
set @bb=CONVERT(datetime,‘2017 04 29 15:00:00‘)
print @bb
print datediff(day, @aa,@bb)
print datediff(hour, @aa,@bb)
print datediff(minute , @aa,@bb)
print datediff(second , @aa,@bb)
==============输出内容====================
04 29 2017 2:58PM
04 29 2017 3:00PM
0
1
2
71
时间: 2024-10-12 03:15:39