Home All Groups Group Topic Archive Search About
Author
24 Apr 2006 10:16 PM
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
--
Paul G
Software engineer.

Author
24 Apr 2006 11:10 PM
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.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net


Show quoteHide quote
"Paul" <P***@discussions.microsoft.com> wrote in message
news:20DABFCC-CE60-4B39-8722-26EAFC382EE7@microsoft.com...
> 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
> --
> Paul G
> Software engineer.
Author
24 Apr 2006 11:23 PM
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.


Show quoteHide quote
"Steve C. Orr [MVP, MCSD]" wrote:

> 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.
>
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> http://SteveOrr.net
>
>
> "Paul" <P***@discussions.microsoft.com> wrote in message
> news:20DABFCC-CE60-4B39-8722-26EAFC382EE7@microsoft.com...
> > 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
> > --
> > Paul G
> > Software engineer.
>
>
>