Cut-off date

NeoBook tips, tricks, code samples and more...

Moderator: Neosoft Support

Locked
Jim Brammer

Cut-off date

Post by Jim Brammer »

"How can I disable a program after a certain date, say 12/31/2001 for example? Low level of security, just want it to stop and not run again..."

<hr>

Take the year, month and day and string them all together as one number. Make sure that you string them together in the right order:

[Year][MonthNum][DayNum]

Compare the resulting value against another pre-defined cut-off date value. If the current date value is greater than your cut-off date number then exit.

The first two segments are to deal with single digit months and days attaching a zero before-hand, (06, 01 = June 1st).


. = = DAY PREP = = = = = =
StrLen "[DayNum]" "[DayNum_Len]"
If "[DayNum_Len]" "=" "1"
SetVar "[d]" "0[DayNum]"
Else
SetVar "[d]" "[DayNum]"
EndIf

. = = MONTH PREP = = = = = =
StrLen "[MonthNum]" "[MonthNum_Len]"
If "[MonthNum_Len]" "=" "1"
SetVar "[m]" "0[MonthNum]"
Else
SetVar "[m]" "[MonthNum]"
EndIf

. = = STRING = = = = = =
SetVar "[datevalue]" "[Year][m][d]"

. = = GO, NO GO FOR LAUNCH = = = =
If "[datevalue]" ">" "20011012"
....Expired
AlertBox "" "This Evaluation has Expired! Exiting..."
Exit "" ""
Else
....Okay to run program
EndIf




disable, evaluation, date
Locked