Sql获取当月月初和月末的时间
时间:2021-07-01 10:21:17
帮助过:230人阅读
@CurrentTime DATETIME
DECLARE @Start DATETIME
DECLARE @End DATETIME
SET @CurrentTime = GETDATE()
SET @Start = DATEADD(ms,
-1,
DATEADD(mm,
DATEDIFF(m,
0,
@CurrentTime),
0))
SET @End = DATEADD(ms,
-3,
DATEADD(mm,
DATEDIFF(m,
0,
@CurrentTime)
+ 1,
0))
PRINT @CurrentTime
PRINT @Start
PRINT @End
Sql获取当月月初和月末的时间
标签: