[url]http://sammyservers.com/wiki/wiki/index09bf.html?title=Os.date[/url]
I'm trying to use the %s modifier for os.date
[code]%s is replaced by the time in seconds since the epoch as a decimal number.[/code]
But whenever I do, I get left this error:
[code][@LuaCmd:1] bad argument #1 to 'date' (invalid conversion specifier '%s')[/code]
Does anyone know why it wouldn't work?
The command I ran:
[lua]lua_run_cl print(tostring(os.date("%s")))[/lua]
Try %S instead of %s
[code]%S is replaced by the second as a decimal number [00,59].[/code]
That's an entirely different thing, I'm using this for a length system for bans.
[code]] lua_run_cl print(tostring(os.date("%S")))
05
[/code]
edit:
Could I just use os.time()?
[QUOTE=Hyper Iguana;35317651]edit:
Could I just use os.time()?[/QUOTE]
Yessir, that is what I actually do too in my custom moderator tool.
[lua]
// Change these variables with how long you want to ban the user.
local banHours = 24
local banMinutes = 0
local banSeconds = 0
// Generate the offset using the above variables.
local banOffset = (banHours * 60 * 60) + (banMinutes * 60) + banSeconds
// Produce the actual time to insert into the database using the above information.
local dbBanTime = os.time() + banOffset;
[/lua]
Sorry, you need to Log In to post a reply to this thread.