date to expire

Is there s way using the date$ statement to make a program not run after a certain date? Can I convert the date$ variable into a non-string variable to compare it with another numerical variable? Also is there a statement that will print text to a specific area on the screen so that my output of different sizes will have a formatted look? Thanks for your help before, you guys are great.


  • You CAN change a date string to a numeric. I use this method

    datadate$ = DATE$ gives 02-16-2002

    DIM NumYear AS LONG
    DIM NumDate AS LONG

    NumYear = VAL(RIGHT$(DataDate$,4) (2002)
    NumMonth = VAL(LEFT$(DataDate$,2) (2)
    NumDay = VAL(MID$(DataDate$,4,2) (16)

    NumYear = NumYear * 10000 (20020000)
    NumMonth = NumMonth * 100 (200)

    NumDate = NumYear + NumMonth + NumDay (20020216)

    Now suppose you want to find if this date falls between 1st April 1955 and 31st March 1960. This is done by converting these two dates to a number in a similar way and comparing the three numbers.

    IF NumDate > 19550401 AND NumDate < 19600331 THEN
    END IF

    As the date is now a number you can do what you want with it.

    To stop the program running you can use

    If NumDate > 20020601 THEN END

    I know it's self advertisement but you can find more stuff on dates, including a perpetural calandar, on my site at

  • That code helped me understand exactly how to do it, and with some changes to my program it worked perfectly, thank you very much for the info.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!