Can't print my timezone due to it getting obscured

I want to print my own timezone using"%Z")
But I cannot do it because it gets obscured. (screenshot)

This may be caused by my system using Russian language but I’m not really sure because output prints cyrillic just fine. I’ve asked about this months ago but at that time I abandoned it because I decided to go with a workaround, there isn’t any more information about this that I could find on the devforum.
What is this caused by and how do I make it print it out as comprehensible characters?

local timezone ="%Z")
local test ="%W %w %Y %A")

print(timezone, test)


15:10:14.681  Classic Baseplate auto-recovery file was created  -  Studio
15:10:34.223  ������������� ����������� ����� 38 5 2022 Friday  -  Client - LocalScript:4

So, from my understanding with a quick search…

The %z gives you the timezone, this may be sufficient for your needs, however please note:

One cannot use"%z") as the format of its return value is non-portable; in particular, Windows systems don’t use the C99 semantics for strftime(). - lua-users wiki: Time Zone

Which means using %z would just give u something that ROBLOX cannot render as a string, hence why the output does that.

In order to get the timezone as a string, then, you’ll do:

-- LocalScript

local timezone ="%m/%d/%y at %H:%M:%S", os.time()) 

-- ServerScript

local function getServerTimeZone(hourOffset, minutesOffset, dst:boolean?)

	local hoursToSeconds = (hourOffset) * 3600 -- this is how you can make timezones
	local minutesToSeconds = minutesOffset * 60

	if dst then
		hoursToSeconds = (hourOffset + 1) * 3600

	return os.time() + hoursToSeconds + minutesOffset


local timezone ="%m/%d/%y at %H:%M:%S", getServerTimeZone(5, 1)) 


09/23/22 at 08:36:52 -- For both, assuming you're still using the same setup with no change.

Hope this helps!


So from what I understood here it is simply gonna be impossible for me to print the timezone because Windows simply can’t provide it in a way that Roblox can render? That’s weird because normally it should just give you whatever your system timezone is as the output. (It did that for me saying my timezone is RTZ 7 before I changed my system language.). Regardless, thanks for the reply! I guess I will use %z instead of %Z and print the timezone as UTC± :slight_smile:

1 Like