Get maximum day from a month

  • Thread starter Thread starter DenBaguse MasRodjie
  • Start date Start date
D

DenBaguse MasRodjie

How to get a maximum days from a month?
For ex: days of january 2003 we get result 31

thank's

Roji
 
DenBaguse MasRodjie said:
How to get a maximum days from a month?
For ex: days of january 2003 we get result 31

Have a look in the DateTime Class, specifically:

System.DateTime.DaysInMonth( ...

HTH,
Phill W.
 
the quickest way that i know of is to create a start date serially...i.e.
current month/01/current year. next, add one month to that date...from this
date, simply subtract one day from it. the subtraction of this resulting
date and the date you created serially will give you the number of days in
the current month.

hth,

steve
 
i see i need to better familiarize myself to the new interfaces supported by
the date object...i have to keep reminding myself that i'm not stuck w/ vb6
anymore ;^) less code is better.

thx phil...didn't know it was that easy!

steve
 
DenBaguse MasRodjie said:
How to get a maximum days from a month?
For ex: days of january 2003 we get result 31

System.DateTime.DaysInMonth:

Public Shared Function DaysInMonth(ByVal year As Integer, ByVal month As
Integer) As Integer
 
Back
Top