Timezone in roblox

You didn’t read my full response

1 Like

Oh you mean the time of day? but what does %X mean

1 Like

5 Likes

As @bolzpy’s screenshot of the documentation shows, %X formats it into the HH:MM:SS format that you want

2 Likes

But is the os.time() in UTC because it seems to be in my timezone? My timezone is UTC + 8

1 Like
local Time = os.date("*t", os.time()) 

Use google.

1 Like

Manually setting is quite inconvinient. You can use “*t” to get the current players timezone though this is only callable on the client.

1 Like

Are you running it on the server or on the client?
When run from the server, it will tell you the EST time.
image
image

1 Like

When did they say they wanted to get the player’s timezone? They said they wanted to get the current EST time.

1 Like

Ohhhhhhhhh… My brain is drunk.

1 Like

The script is on a server script and I just ran it

1 Like

@SeargentAUS Here is the code and the results

while true do
	wait(1)
	local Time = os.date("%X", os.time() - 5 * 3600)
	print(Time)
end

1 Like

Do it in a Roblox server, not in studio

1 Like

@SeargentAUS
os.time() returns the local time, not UTC.

You can use os.date.

Code:

while task.wait(1) do
	local Time = os.date("!*t", os.time() - 5 * 3600)
	print(`{Time.hour}:{Time.min}:{Time.sec}`)
end
1 Like

When run on the server, os.time() returns the UTC time.
When run on the client, os.time() returns the local time.

This has already been expressed previously in the thread.

1 Like

Yeah, but os.date() works anywhere, it should be used instead, especially if you only need to know the time on the client.

2 Likes

So is this code correct or I need to follow what @SeargentAUS said which is to go and do it in the Roblox server?

1 Like

Both will achieve the same outcome

2 Likes

Btw, I am just curious, what does {} mean

It’s called string formatting. You can put a variable inside the brackets and it will display it in the string.

1 Like