//C# 代码int year = DateTime.Now.Year;int month = DateTime.Now.Month;DateTime firstDayOfThisMonth = new DateTime(year, month, 1);DateTime lastDayOfThisMonth = new DateTime(year, month, DateTime.DaysInMonth(year, month));
//SQL代码DECLARE @NOW DATETIMEDECLARE @FistDayOfThisMonth DATETIME DECLARE @LastDayOfThisMonth DATETIMESET @NOW = GETDATE()SET @FistDayOfThisMonth = @NOW - DAY(@NOW) + 1 SET @LastDayOfThisMonth = DATEADD(MONTH, 1, @NOW - DAY(@NOW) + 1) - 1SELECT @FistDayOfThisMonthSELECT @LastDayOfThisMonth
以上就是本文的全部内容,希望对大家有所帮助,同时也希望多多支持武林网!
新闻热点
疑难解答