Retrieving a date from a os.time() (Unix time)

I want to make a system where I can request a number (os.time()) and return a string containing the date of this os.time();

I’ve thought first about using HTTPService, but some people seem to be using another thing which I’m not sure of, does anybody know a website that allows you to retrieve this kinda of info?

I’ll maybe make a module for people to use;

1 Like

The os library has this already, that is os.date(). It will return a table with info of the current time. You can give it an argument, either "!*t" for utc time or "*t" for local time.

There are other format specifiers as well, have a look:

2 Likes

Hm weird, I was just looking at a post talking about they wanted this on roblox lua because it was removed, thanks.

edit: How does this local time think work? How does it know?

1 Like

How does this “local time think work”? What do you mean? If you mean how os.time() works, it always returns the same time no matter where the server is located (UTC). It returns the number of seconds that have passed since 1970, the UNIX Epoch. If you want to find out more info, read the article that @sjr04 linked as it explains in-depth how the function works. Good luck :slight_smile:

2 Likes

When it says local time it is probably talking about the timezone of the machine it is running on. So from a localscript it should probably use the client’s timezone.

1 Like

Do you mean what he wants? He did not specify what he wanted so I was just wondering.

2 Likes