Get minimum and maximum dates

Discussion in 'ASP .Net' started by itsolutionsfree@gmail.com, Mar 10, 2006.

  1. Guest

    Hi All,

    i am deep trouble.so,please help me how to get minimum and maximum
    dates for particular Month and Year.Any kind of help will help.

    for ex: im passing : March 2006

    Minimum Date - 01/March/2006
    Maximum Date - 31/March/2006

    my code:

    public sub MinMaxdate(ByVal MonInt as integer,ByVal YeaInt as integer)
    Dim MinInt as integer
    Dim MaxInt as integer

    msgbox "Minimum Date " & "MinInt" & " Of " & MonInt & "/" & YeaInt
    msgbox "Maximum Date " & "MaxInt" & " Of " & MonInt & "/" & YeaInt

    end sub

    With Regards,
    IT SolutionsFree
    , Mar 10, 2006
    #1
    1. Advertising

  2. Chris Taylor Guest

    Hi,

    Well the min date is easy, it is always the 1st. For the max date you can
    use DateTime.DaysInMonth try the following function.

    Public Function MaxDate(ByVal year As Integer, ByVal month As Integer) As
    DateTime
    Return New DateTime(year, month, DateTime.DaysInMonth(year, month))
    End Function

    Hope this helps

    --
    Chris Taylor
    http://dotnetjunkies.com/weblog/chris.taylor


    <> wrote in message
    news:...
    > Hi All,
    >
    > i am deep trouble.so,please help me how to get minimum and maximum
    > dates for particular Month and Year.Any kind of help will help.
    >
    > for ex: im passing : March 2006
    >
    > Minimum Date - 01/March/2006
    > Maximum Date - 31/March/2006
    >
    > my code:
    >
    > public sub MinMaxdate(ByVal MonInt as integer,ByVal YeaInt as integer)
    > Dim MinInt as integer
    > Dim MaxInt as integer
    >
    > msgbox "Minimum Date " & "MinInt" & " Of " & MonInt & "/" & YeaInt
    > msgbox "Maximum Date " & "MaxInt" & " Of " & MonInt & "/" & YeaInt
    >
    > end sub
    >
    > With Regards,
    > IT SolutionsFree
    >
    Chris Taylor, Mar 13, 2006
    #2
    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. David Lozzi

    Dates dates dates dates... SQL and ASP.NET

    David Lozzi, Sep 29, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    845
    Rob Schieber
    Sep 30, 2005
  2. Replies:
    7
    Views:
    338
    Keith Thompson
    Sep 16, 2007
  3. Replies:
    8
    Views:
    774
    Ben Bacarisse
    Oct 19, 2008
  4. PW

    Dates! Dates! Dates!

    PW, Aug 7, 2004, in forum: ASP General
    Replies:
    4
    Views:
    179
    Mark Schupp
    Aug 9, 2004
  5. Peng Yu
    Replies:
    16
    Views:
    415
    Philip Potter
    Jan 31, 2010
Loading...

Share This Page