The Daily WTF: Curious Perversions in Information Technology
Welcome to TDWTF Forums Sign in | Join | Help
in Search

(funny old vb5) find out the last day of month

Last post 10-06-2008 12:22 PM by zzo38. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 09-09-2008 12:27 PM

    (funny old vb5) find out the last day of month

    For i=31 to 28 Step -1

    sDateTo = iMonth &"/" & i & "/" &iYear

    If IsDate(sDateTo) Then Exit For

    Next

     

    p/s Enjoy)

  • 09-09-2008 1:43 PM In reply to

    Re: (funny old vb5) find out the last day of month

    Nice one!  I assume this is a "clever" way of determining how many days are in the given month/year ?

    I did not become a TDWTF forum moderator to make friends. And by the way, I haven't.
  • 09-09-2008 1:54 PM In reply to

    Re: (funny old vb5) find out the last day of month

     Actually, this piece of magic (mushroom) code calculates the last day of specified month (so its maybe 31 or 30 or 29 or 28)))))

    Here is less magic but still working code :

    sDateTo = DateAdd("m",1,firstDayOfMonth)-1

     

  • 10-06-2008 12:22 PM In reply to

    Re: (funny old vb5) find out the last day of month

    I have used this code to figure out how many days in a month (y is the year you want to check, and m is the month you want to check):
    Day(DateSerial(y, m + 1, 0))
    : IF` 0=GOTO` ALLOT-CELL ;
    : THEN` HERE SWAP ! ;
    : ELSE` GOTO` ALLOT-CELL SWAP THEN` ;


    gopher://zzo38computer.cjb.net/
Page 1 of 1 (4 items)
Powered by Community Server (Non-Commercial Edition), by Telligent Systems