#### Howdy, Stranger!

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

# date to expire

Member Posts: 9
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.

• Member Posts: 60
You CAN change a date string to a numeric. I use this method

DIM NumYear AS LONG
DIM NumDate AS LONG

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
............
............
ELSE
............
............
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 http://members.lycos.co.uk/brisray/qbasic/qdate.htm

Ray
• Member Posts: 9
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.
• USAMember Posts: 4,624 ✭✭

\ http://forcoder.org \ free ebooks and video tutorials about \ Python, Perl, PHP, Delphi, Java, Scratch, MATLAB, Assembly, PL/SQL, Swift, R, Visual Basic .NET, JavaScript, Go, Ruby, C#, Objective-C, C++, C, Visual Basic D, Hack, Julia, Awk, Transact-SQL, LabVIEW, Dart, ML, SAS, Clojure, Fortran, Lisp, Erlang, Kotlin, Scheme, Bash, F#, Crystal, ABAP, FoxPro, Apex, Ada, Lua, VBScript, Logo, Rust, Prolog, COBOL, Alice, Scala \ ________