Calendar control question

Discussion in 'ASP .Net Web Controls' started by Paul, Apr 24, 2006.

  1. Paul

    Paul Guest

    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.
     
    Paul, Apr 24, 2006
    #1
    1. Advertising

  2. 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" <> wrote in message
    news:...
    > 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.
     
    Steve C. Orr [MVP, MCSD], Apr 25, 2006
    #2
    1. Advertising

  3. Paul

    Paul Guest

    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 [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" <> wrote in message
    > news:...
    > > 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.

    >
    >
    >
     
    Paul, Apr 25, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Natty Gur
    Replies:
    0
    Views:
    883
    Natty Gur
    Nov 10, 2003
  2. Trint Smith
    Replies:
    2
    Views:
    472
    Trint Smith
    Feb 26, 2004
  3. Shevek
    Replies:
    3
    Views:
    6,122
    Shevek
    Jun 23, 2004
  4. Shevek
    Replies:
    0
    Views:
    424
    Shevek
    Jun 23, 2004
  5. Parthiv Joshi
    Replies:
    1
    Views:
    808
    Samuel L Matzen
    Jul 6, 2004
Loading...

Share This Page