# Get minimum and maximum dates

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

1. ### Guest

Hi All,

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

2. ### Chris TaylorGuest

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,
>
> 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