Q: start and end date

G

Guest

Hello,
How can I find start date and end date of a month from month name in c#? So
for example if February is selected from a dropdown list for this year I
should set 2/1/2005 and 2/28/2005?
Thanks,
 
E

Edwin Knoppert

Create a new date/time object having (year, month, 1)
For 2nd use another and do addmonth(1).Adday(-1)
 
E

Eliyahu Goldin

Start date is obviously not a problem. Given the start date is stored in a
DateTime variable startDate, obtain the end date as

startDate.AddMonths (1).AddDays (-1);

Eliyahu
 
D

Daniel Fisher\(lennybacon\)

Sorry, wrong link. Here it is

DateTime.DaysInMonth(m_Year, m_Month);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,681
Members
48,796
Latest member
Greg L.

Latest Threads

Top