Server crashes when using os.date("%OH")

So I am trying to get the date in a string that looks like: “10/1/2014 7:07:46”

When ever I use the %OH tag to get the hour the server just crashes.



local date = os.date("%d/%m/%Y %OH") //this makes the server crash
local ply = nil
local plyStr = nil

print(date)


Some of the tags will crash the server as soon as you try to use them, it’s been that way for a long time I think.

There’s a whole list of the tags here https://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index09bf.html

There’s a note at the bottom of the page about some of them causing crashes, probably not an exhaustive list though.

Any invalid flag will crash on Windows (other systems will depend). You should only use flags documented on both http://msdn.microsoft.com/en-us/library/fe06s4ak.aspx and http://unixhelp.ed.ac.uk/CGI/man-cgi?strftime

I do it like this for nicely formatted date/time: http://codepad.org/IKte92pg

You can use date.hour%12 if you want 12 hour clock.