OS.Date() weren’t correct so I made this hacky piece of code that grabs your local time, I will not be explaining how does this piece of codes works because its way too hacky even for you to understand. Once you run this code inside of a LocalScript it will return your OS’ date. This probably only works on Windows because of the fact that I haven’t tested this on MacOS or Linux clients yet, enjoy!
-- Property of @GamebringerDev
local t = tick()
local TypeOS = 0
local Sec = true
local Year = 1970
local Month = 1
local Day = 1
local Date = "January 1, 1970"
local Hour = 0
local Minute = 0
local Second = 0
local Tag = "AM"
local Time = "12:00 AM"
function getDate()
local Months = {
{
"January",
31,
31
},
{
"February",
59,
28
},
{
"March",
90,
31
},
{
"April",
120,
30
},
{
"May",
151,
31
},
{
"June",
181,
30
},
{
"July",
212,
31
},
{
"August",
243,
31
},
{
"September",
273,
30
},
{
"October",
304,
31
},
{
"November",
334,
30
},
{
"December",
365,
31
}
}
Year = math.floor(1970 + t / 31579200)
if Year % 4 == 0 then
Months[2][3] = 29
for i, v in pairs(Months) do
if i ~= 1 then
v[2] = v[2] + 1
end
end
end
Day = math.floor(t / 86400 % 365.25 + 1)
for i, m in pairs(Months) do
if m[2] - m[3] <= Day then
Month = i
end
end
local m = Months[Month]
Day = Day + m[3] - m[2]
Year, Day = tostring(Year), tostring(Day)
local c, s = ", ", " "
Date = Months[Month][1] .. s .. Day .. c .. Year + 1
end
function getTime()
TypeOS = 1
Second = math.floor(t % 60)
Minute = math.floor(t / 60 % 60)
Hour = math.floor(t / 3600 % 24)
Second = tostring((Second < 10 and "0" or "") .. Second)
Minute = tostring((Minute < 10 and "0" or "") .. Minute)
Tag = TypeOS == 0 and (Hour < 12 and "AM" or "PM") or ""
Hour = (TypeOS == 1 and Hour < 10 and "0" or "") .. tostring(TypeOS == 0 and (Hour == 0 and 12 or Hour > 12 and Hour - 12 or Hour) or Hour)
local c, s = ":", TypeOS == 0 and " " or ""
Time = Hour .. c .. Minute .. (Sec and c .. Second or "") .. s .. Tag
end
function StartFunction()
while true do
t = tick()
getDate()
getTime()
print(Time..", "..Date)
wait()
end
end
StartFunction()