Months and dates problem

I have been trying to do a calendar problem using the months of the year. 30 days for April, 31 for December etc. But I am stuck. I was going to use a select case, but again, stuck.

Any help would be useful.

Thanks



Answer this question

Months and dates problem

  • Shaiq Bashir

    You DMan, DMan!

    (betcha not heard that one before...)



  • Helmut Leitner

    To find out how many days are in a given month use the "DaysInMonth" method of the date class:

    Date.DaysInMonth()

    Dim MyDate As Date = #11/9/2006#

    Dim DaysInMonth As Integer = Date.DaysInMonth(MyDate.Year, MyDate.Month)



  • F.Costa

    Presumably, you want to find out how many days are in each month

    There is an algorithm to do this (look it up on wiki, probably), but your easiest method may be to do this:

    • Go to the month following the month you want (include the year! Not all months have the same number of days each year!).
    • Go to the first day.
    • Subtract one day.
    • Read the day number.


  • _Kris

    I don't get the problem so far, can you explain a bit more and maybe show code you have which doesn't work like you want it to.

    --
    SvenC


  • AndrewVos

    As you know, 30 days in september, april, june and november. the rest obviously have 31 days apart from february. I am using a domain up & down for the months and a numeric up & down for the days. So i have got to work out a way of getting the correct days for the correct month. That is where i am stuck


  • Months and dates problem