This is a discussion on Get Last Day of the Month Function within the Database Support forums, part of the Web Development category; How to Get Last Day of the Month Function in SQL Server CREATE FUNCTION [dbo].[ufn_GetLastDayOfMonth] ( @pInputDate DATETIME ) RETURNS DATETIME ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| How to Get Last Day of the Month Function in SQL Server CREATE FUNCTION [dbo].[ufn_GetLastDayOfMonth] ( @pInputDate DATETIME ) RETURNS DATETIME BEGIN DECLARE @vOutputDate DATETIME SET @vOutputDate = CAST(YEAR(@pInputDate) AS VARCHAR(4)) + '/' + CAST(MONTH(@pInputDate) AS VARCHAR(2)) + '/01' SET @vOutputDate = DATEADD(DD, -1, DATEADD(M, 1, @vOutputDate)) RETURN @vOutputDate END GO |
| Sponsored Links |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Number of days in a month (or last day of a month) | itbarota | HTML, CSS and Javascript Coding Techniques | 2 | 04-28-2008 08:47 PM |
| Find the last day of the month for any given month. | itbarota | HTML, CSS and Javascript Coding Techniques | 1 | 03-17-2008 08:56 PM |
| Calculate how many hours per each month | itbarota | HTML, CSS and Javascript Coding Techniques | 1 | 02-25-2008 09:23 PM |
| Get First Day of the Month Function | srikumar_l | Database Support | 0 | 12-21-2007 08:37 PM |
| Diff inline function and ordinary function | vigneshgets | C and C++ Programming | 1 | 05-24-2007 11:34 AM |