Search code examples
timesmallbasic

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


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?


Solution

  • 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.