例如我需要
的日期差异1.DECLARE @lDFROM DATE ='2016-12-01',@ lDTO DATE ='2018-05-31'
结果:
18 noofmnth,
0 nofweek,
0 noofdays
2.DECLARE @lDFROM DATE ='2016-12-31',@ lDTO DATE ='2018-05-25'
结果:
17 noofmnth,
3 nofweek,
4 noofdays
答案 0 :(得分:0)
使用datediff
select DATEDIFF(wk,'2016-12-01','2018-05-31')+1