LS3VEN
(LS3VEN)
August 7, 2021, 11:39pm
#1
What do you want to achieve? Keep it simple and clear!
I’d like to have a GUI in the center of the screen that displays a certain timezone (-7 MST) for all of the players in the current server
What is the issue? Include screenshots / videos if possible!
Answered in 1.
What solutions have you tried so far?
I’ve looked around on the internet and so far I’ve found nothing but how to make realistic lighting with timezones.
If you can help, it would be much appreciated! Thank you in advance
xJon_as
(Jonas)
August 7, 2021, 11:47pm
#2
Hi!
Easy way: http request to this api:
Hard (but “right” way)
Use UTC time functions:
In case anyone runs into this thread looking for a valid use for UTC time functions.
os.time() returns the number of seconds since the unix epoch (January 1, 1970 12:00 AM UTC). This may be different than other Lua environments you’re used to. You should call this function on the server to save timestamps for things like “last logged on”.
On the client, you should call os.date("*t", some_time_value) to get a table containing the year/month/day/etc for the value that os.time() returned. The rea…
1 Like
LS3VEN
(LS3VEN)
August 7, 2021, 11:52pm
#3
Oof… well I really don’t script much but thanks for the help!
1 Like
Abcreator
(Abcreator)
August 8, 2021, 12:15am
#4
os.time() then add the hours and then run os.date(newTime) to get a table of the date.
1 Like
local now = os.time() - 25200 -- UTC-7
local timeTable = os.date("!*t", now)
print(timeTable) -- Check console for the table variables.
Hope that helps you!
2 Likes
24Lego
(woo)
August 8, 2021, 7:43am
#6
What timezone are you looking for? I’ll try and write you a quick script using that website.
1 Like
Rather not use HttpService for getting the time, as you can exhaust the quota of HTTP requests quickly.
1 Like
LS3VEN
(LS3VEN)
August 11, 2021, 2:44pm
#8
Whoops, I haven’t been on the Developer Forum in a few days, sorry! It’s -7 or MST Arizona Time