Small Basic - How to check if a date is passed?

186 views Asked by At

I'm trying to make a license verification that should expire in a week with small basic. I could make a script that would write down the day the license was activated and that would expire the license as soon as the current day is 7 larger than the written amount. The problem is that if you'd activate the license on 28/any month, the license wouldn't expire since the current day would never be 35/any month. Is there a way to make small basic check if a date has been passed without making a script with about 100 If-Then's?

2

There are 2 answers

2
KevinDTimm On BEST ANSWER

In gross terms, you need a date based upon an epoch, not the day of the month.

IOW, count the number of days since an event, store that value, when the current date is 7 days after the original date, expire.

http://litdev.co.uk/ offers a smallbasic library that provides this functionality if you don't want to roll your own.

0
Bob Cratchit On

Save the time into a file using the

File.Writeline("File Path", 1, Clock.Date())

then compare it to the time when the program starts up again.

Days_since_last_on = Clock.Date() - File.Readline("File Path", 1)