The difference between them is that os.time uses UTC , while tick() uses the current timezone. (tick() on the client returns time relative to the machine’s time zone while on the server it returns time relative to the server’s time zone), tick exposes miliseconds while os.time does not.
tick returns the current server time in “Unix Time Format”. It is not proper Unix time. It’s a very large number, and this number is affected by timezones as servers in ROBLOX are misconfigured and return the wrong time , based on the timezone that they are in.
It’s recommended to use os for stuff like that.
You want to get date with tick? Here you go.
local data = os.date("*t", tick()); --// check article for more info
print(data.day, data.month, data.year)
local function getCurrentTimeFormat(seconds)
local currentTime = os.date("!*t")
if seconds then
currentTime = os.date("*t", seconds)
end
local hour = currentTime.hour
local minute = currentTime.min
local second = currentTime.sec
local day = currentTime.day
local month = currentTime.month
local year = currentTime.year
if hour < 10 then
hour = 0 .. hour
end
if minute < 10 then
minute = 0 .. minute
end
if second < 10 then
second = 0 .. second
end
if day < 10 then
day = 0 .. day
end
if month < 10 then
month = 0 .. month
end
if year < 10 then
year = 0 .. year
end
return ("%s:%s:%s, %s/%s/%s"):format(hour, minute, second, month, day, year)
end
Easier format, you can play around it if you wish.