Get minimum and maximum dates

I

itsolutionsfree

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
 
C

Chris Taylor

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
 

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

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top