Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I use date and or time in a database?

Asked by 7 years ago

I want to make a daily login reward that players only get once a day.

But everywhere I look it shows something called "os.time" or "os.date" but they are apparently locked by roblox? Where do I get the current time and/or date for my datastore?

1 answer

Log in to vote
1
Answered by 7 years ago
Edited 7 years ago

We currently do not have access to os.date so we need to use os.time()/tick() which is epoch time. os.time returns the number of seconds since the epoch (1 January 1970, 00:00:00)

To work this out you would need to calculate how many seconds in year, month day ect.

Here are some links to help:-

how-do-you-get-the-date-and-time-from-unix-epoch-time)

ostime-how-to-use-it

Also I have made a module there are better mathematical approaches to this but I chose a logical approach.

There are also other questions on the SH forum which may help.

Hope this helps

Ad

Answer this question