Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Days in Month

Status
Not open for further replies.

VBXL

Programmer
Joined
Jul 10, 2001
Messages
198
Location
GB
Hi

Is the a formula to work out how many days are there in a month.
 
SELECT DAY(DATEADD(d, -DAY(GETDATE()),DATEADD(m,1,GETDATE())))

These links contain scripts that find the last day of the month.

Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Hi Xplain,
See the following query.

select DateDiff(d,getdate(), Dateadd(m, 1, getdate())) as NoOFDays

I have used system date function getdate() as an example. You can form the date when a month is supplied.

Suppose a month & year is passed
you can form the date by concatenating
month/day/year
month & year can be passed & day can be kept constant as 1.

Hope this helps.

Mukund.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top