/ Published in: SQL
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
CREATE FUNCTION [GetLastDateofMonth] (@DATE AS DateTime) RETURNS DateTime AS BEGIN DECLARE @LastDate DateTime SET @LastDate = DateAdd(MONTH, 1, @DATE - DAY(@DATE) + 1) -1 RETURN @LastDate END GO
URL: http://www.databasejournal.com/scripts/article.php/3583671/Get-FirstLast-Date-of-Month.htm