how would I make it get today and make it so that the expiry date is 15 days from the day selected ALL the time? So that way i don't have to keep changing the expire date for each client.
Rem Project: expire
Rem Created: Wednesday, January 12, 2011
Rem ***** Main Source File *****
expireDate$=get date$() `Expires 1st feb 2011 - note dbpro style date! MM/DD/YY
expireDay=dateToDays(expireDate$) `Expiry date in days passed since 1/1/2000 - you could store just this number in your app to make it harder to spot
nowDay=dateToDays(get date$()) `Todays date in days since 2000
if nowDay>expireDay
print "Expired "+str$(nowDay-expireDay)+" days ago"
else
print expireDay-nowDay;" days left"
endif
wait key
end
Function dateToDays(dat$)
mth=val(left$(dat$,2)) `Extract month, day, year (dbpro date format MM/DD/YY)
day=val(mid$(dat$,4,2))
yr=val(right$(dat$,2))
if mth<=0 then mth=1
if day<=0 then day=1
inc day,(yr*365)+(yr/4) `Add days for each year (Rough leap year calc accurate to 2100?)
inc day,(31*(mth>1))+(28*(mth>2))+(31*(mth>3))+(30*(mth>4))+(31*(mth>5))+(30*(mth>6)) `Add days for passed months
inc day,(31*(mth>7))+(31*(mth>8))+(30*(mth>9))+(31*(mth>10))+(30*(mth>11))
if mth>2 and (((yr mod 4)=0 and (yr mod 100)>0) or (yr mod 400)=0) then inc day `If current leap year and past feb then add 1 day for feb 29
Endfunction day
basically, whatever date they download it is the start date, and 15 days from whenever they downloaded it, is the end date.
CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!