okay this is actually WAY simpler than it seems;
set your current Unix time as a variable ( print(os.time()) in studio command bar ), this will be used as a DiffStamp
now you can get a universal time passed in seconds by doing this:
local Passed = os.time()-DiffStamp
Ex: print(Passed, 's have passed since start');
since you want 1 week to count as 1 in game month, you can do this by finding out how much 1 IRL second is a in game second, which is about 4.29 seconds. ( 1 IRL = 4.29 IN GAME )
Now you need a date where you want your calendar to start, which you can get in https://www.unixtimestamp.com/
for the example i picked Jan 01 1999. ( Unix time can only go as low as Jan 01 1970 )
Then you simply have to subtract the current time with the diff stamp , multiply it by 4.29, and add it to the start time stamp!
local CurrentDate = StartTimeStamp + (os.time()-DiffStamp)*4.29
Final script w/ time stamps to test
local StartTimeStamp = 915166800 -- when you want your calendar to start
local DiffStamp = 1732906300 -- the time you began to track days
local function TimeInSeconds(_time: number)
return StartTimeStamp + (_time-DiffStamp)*4.29;
end
local function CurrentTimeInSeconds()
return StartTimeStamp + (os.time()-DiffStamp)*4.29;
end
local test_times = {
1732906300, -- Starting point
1732982700, -- 1 day after DiffStamp
1733482700, -- 60 days after DiffStamp
1734320300, -- 100 days after DiffStamp
1765065300, -- 1 year after DiffStamp
1796700300, -- 2 years after DiffStamp
1828335300, -- 3 years after DiffStamp
1898335300, -- 5 years after DiffStamp
2000000000, -- 10 years after DiffStamp
}
for _, test_time in ipairs(test_times) do
print(os.date("%Y-%m-%d %H:%M:%S", StartTimeStamp+(test_time-DiffStamp)), '->', os.date("%Y-%m-%d %H:%M:%S", TimeInSeconds(test_time)))
end
Hope you learned something new ask me any questions if you have any.