os.time supports a dictionary parameter, which can be used to specify a specific date. os.time will return the number of seconds since the UNIX Epoch to the date using the entries in the dictionary, or it will use the time when it was called if one isn’t specified. The date format is often gotten using os.date.
The date dictionary requires the day, month and year keys. Any other keys modify the end time. For example, specifying hours and minutes will push the date forward a bit from 00:00 and change the number of seconds retrieved.
os.time(os.date("!*t"))
-- Returns the number of seconds since the UNIX Epoch to the date
As shown on the os library page, os.time is written as though it does not accept any parameters.
Thought to bring this one back up since more developers are beginning to make use of the os library and an issue with the page was recently fixed. I think it would be valuable to list two versions of os.time: one without the dictionary parameter and one with, to show the functional difference when passing a date table.
Heya. 7 months later and, seeing that a lot of developers are starting to integrate os-based features into their games (rewards systems for logging in after a few hours, subscription services, live markets, so on), it would be nice to have this information on hand. The information is still missing and there might be someone out there with a use case for finding out the seconds that’ll be elapsed at a specific date.
Like ColorSequence, it would be nice to add a second box under os.time() that shows what would happen if a date table was passed. Adding it to the current box might confuse developers in thinking that a date table is required to be passed as a parameter. A second box would also allow for expanding on what would happen should a date table be passed.