Calendar control question

P

Paul

Hi I have a vs2003 .net calendar control and what I need to do is when the
user makes any selection for the entire month I need to get the year and
month of the selection but then also need to get just the last day of that
month and year. I looked at the calendar class but did not see anyway to
return the last day of the selected month?
Thanks
 
S

Steve C. Orr [MVP, MCSD]

This is not a function of the calendar control.
There is functionality in the DateTime class that can roughly handle this.
Since the first day of the month is easier to get, simply get the first day
of the following month and then subtract one day using the DateAdd method.
 
P

Paul

ok thanks for the reply. I just implimented something and ended up using the
following that seems to be working,
using System.Globalization;
GregorianCalendar mycal =new GregorianCalendar();
int i_daysinmonth = mycal.GetDaysInMonth(i_year,i_month);

--
Paul G
Software engineer.


Steve C. Orr said:
This is not a function of the calendar control.
There is functionality in the DateTime class that can roughly handle this.
Since the first day of the month is easier to get, simply get the first day
of the following month and then subtract one day using the DateAdd method.
 

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
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top