In a previous thread (thread183-1120970) I obtained some information that helped me to get the last day of a month if I provided a date.
Here is the function I created in MSSQL:
Here is the function I created in MSSQL:
Code:
CREATE FUNCTION fn_GetLastDayOfMonth (@date DATETIME)
RETURNS DATETIME AS
BEGIN
SET @date = DateAdd(month,1,@date);
SET @date = CONVERT(CHAR(10), CAST(MONTH(@date) AS VARCHAR(2)) + '/01/' + CAST(YEAR(@date) AS VARCHAR(4)), 101);
SET @date = DATEADD(d, -1, @date)
RETURN @date;
END
[code]
I hope this helps you.
Michael Libeson