sql 获取当天开始时间 结束时间
2010-06-21 00:00:00.000
SELECT dateadd(ms,0,DATEADD(dd, DATEDIFF(dd,0,getdate()), 0))
2010-06-21 23:59:59.997
SELECT dateadd(ms,-3,DATEADD(dd, DATEDIFF(dd,-1,getdate()), 0))
ms步频是3
当月第一天
SELECT DATEADD(mm, DATEDIFF(mm,0,getdate()), 0)
当月最后一天
SELECT dateadd(ms,-3,DATEADD(mm, DATEDIFF(m,0,getdate())+1, 0))