Using mathematical calculations, you can "expire" a code at a certain date by using the following. Simply adapt the code (I did an example of how to adapt it below) and go from there.
function CurrentDate(z)
local z = math.floor(z / 86400) + 719468
local era = math.floor(z / 146097)
local doe = math.floor(z - era * 146097)
local yoe = math.floor((doe - doe / 1460 + doe / 36524 - doe / 146096) / 365)
local y = math.floor(yoe + era * 400)
local doy = doe - math.floor((365 * yoe + yoe / 4 - yoe / 100))
local mp = math.floor((5 * doy + 2) / 153)
local d = math.ceil(doy - (153 * mp + 2) / 5 + 1)
local m = math.floor(mp + (mp < 10 and 3 or -9))
return y + (m <= 2 and 1 or 0), m, d
end
function CurrentTime(hoursOffset)
local unixTime = math.floor(os.time()) - (60*60*(hoursOffset or 0))
local hours = math.floor(unixTime / 3600 % 12)
local minutes = math.floor(unixTime / 60 % 60)
local seconds = math.floor(unixTime % 60)
local year, month, day = CurrentDate(unixTime)
return {
year = year,
month = month,
day = day,
hours = hours,
minutes = minutes < 10 and "0" .. minutes or minutes,
seconds = seconds < 10 and "0" .. seconds or seconds
}
end
local date = CurrentTime(-7)
print(date.month .. "/" .. date.day .. "/" .. date.year .. " " .. date.hours .. ":" .. date.minutes .. ":" .. date.seconds)
twitterCode = "TwitterYay"
if date.month == 3 and date.day == 5 and date.year == 2018 then
twitterCode = "TwitterYay2"
end
Hopefully you get how I adapted it from the original time script, if not, here is a value directory:
date.month = month number
date.day = day of the month
date.year = number of the year
date.hours = hour of the day
date.minutes = minute of the day
date.seconds = second of the day
3 comments
DataStores
That's such a vague response. Obviously it's something to do with datastores but how do you make it so you set it to expire, lets say after 24 hours or something?
such a vague question