SetExpireTime||doc136351

September 20, 2022

Format

RankDataStore:SetExpireTime(key, expireStampTime)

Describe

Set the time stamp of leaderboard data expiration. After the time stamp, the data will be cleared and can be used for daily, weekly, monthly, etc.

parameter

Variable name Type Describe
key string key
expireStampTime int time stamp

Code example

Set the "player combat power" leaderboard data to be invalid at 12 o'clock tomorrow.

local tomorrowTimestamp = os.time() + 24 * 60 * 60
local expireDateTime = os.date("*t", tomorrowTimestamp)
local expireTime = os.time({ year = expireDateTime.year, month = expireDateTime.month, day = expireDateTime.day, hour = 12, minute = 0, second = 0 })

local playerPowerData = Engine.DataService:GetRankDataStore("PlayerPower")
playerPowerData:SetExpireTime(expireTime)