I have a stored procedure that runs to pull data for sales in a given month. It does not return 31 days on months that have 31 days. I need some help understanding the breakdown of the following string
(dateadd(dd,-(datepart(dd,getdate())),CONVERT(CHAR(8),GetDate(),112)))+'23:59:59')
I understand that CONVERT(CHAR(8),GetDate(),112)
is taking the system date and converting to YYYYMMDD
and that datepart(dd,getdate())
takes the system date and takes just the day part, but I cannot decipher the entire string.