Velocity Reviews > Get minimum and maximum dates

# Get minimum and maximum dates

itsolutionsfree@gmail.com
Guest
Posts: n/a

 03-10-2006
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
Guest
Posts: n/a

 03-13-2006
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

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> 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
>