In
this article I am going to explain how to get the current month name with number
of days in Sql server.
In
the previous article I have explained how to get the number of days in currentmonth in Sql server, how to create autocomplete textbox using angularjs inasp.net mvc application, how to fill dropdownlist using AngularJs in MVC and
how to populate dropdownlist based on another dropdownlist using AngularJs inMVC.
Implementation:
To
get the name of the month with number of days run the below given query in Sql
server:
declare @currentdate datetime
set @currentdate =
getdate()
SELECT datename(month, @currentdate) as MonthName,
DATEPART(day, DATEADD(s,-1,DATEADD(month, DATEDIFF(month,0,@currentdate)+1,0))) as NumberOfDays
OR
declare @currentdate datetime
set @currentdate =
getdate()
SELECT datename(month, @currentdate) as MonthName,
DAY(DATEADD(day,-1,DATEADD(month, DATEDIFF(month, 0, @currentdate) + 1, 0))) as
NumberOfDaysInMonth
No comments:
Post a Comment