日期:2014-05-17 浏览次数:20468 次
declare @start date
declare @end date
declare @time1 date
declare @time2 date
--获取当前月的开始时间
set @start=DATEADD(MM,DATEDIFF(MM,0,GETDATE()),0)
--获取当前月的结束时间
set @end=DATEADD(SECOND,-1,DATEADD(MM,DATEDIFF(MM,0,GETDATE()),0))
set @time1='2012-01-09'
set @time2= '2012-02-26'
print @start
print @end
print @time1
print @time2
if(@time1>@start and @time2<@end)
print '该时间段在本月之内'
else
print '该时间段不在本月之内'