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