Get minimum and maximum dates

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

  1. 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
     
    itsolutionsfree, Mar 10, 2006
    #1
    1. Advertisements

  2. itsolutionsfree

    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, Mar 13, 2006
    #2
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.