Home Forums SQL Server 7,2000 T-SQL Calculate Last and First Day of the Month RE: Calculate Last and First Day of the Month

  • Ain't date handling marvellous?  All sorts of ways of "skinning the cat".  My approach to getting the first day of the month and first of the next is as follows ... (I always use alpha for the month ... saves confusion).

    declare @today datetime

    select @today=getdate()

    select
      '01 '+substring(convert(char(11),@today,106),4,11),

      '01 '+substring(convert(char(11),dateadd(month,1,@today),106),4,11)

    01 Feb 2004 01 Mar 2004