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

How do I get a certain value out of os.date()?

Asked by 6 years ago

So, how would I be able to use os.date() and get a certain value out of it (in my instance, yday)? It's just a short question :P

1 answer

Log in to vote
0
Answered by
Trewier 146
6 years ago
Edited 6 years ago

As stated on the wiki: Format string must be either *t or !*t. *t is local time (only useful on the client), and !*t is UTC. So, when we are grabbing os.date() a format string must be passed to it, use *t if you would like to get local and !*t to grab UTC time.


osDate = os.date(*t) yDay = osDate.yday print(yDay)
0
2 things wrong. The first parameter is incorrect, it needs to be os.time, and second thing that is incorrect, is that that is not how you get a value out of a dictionary. hiimgoodpack 2009 — 6y
0
@hiimgoodpack I think I clearly said OS.DATE. os.time just returns the time in seconds since the Epoch. TechnologicalDiamond 2 — 6y
0
Unix Epoch* TechnologicalDiamond 2 — 6y
Ad

Answer this question