I'm inserting a string variable to my MySQL table using this os.date()
function call:
tSend["sDate"] = os.date( "%Y-%m-%d %X", Core.GetUserValue(v, 25) )
The table tSend is forwarded to another function which inserts it into the table.
This doesn't work as required. For eg. It'll insert 2013-01-31 12:59:59 instead of 2013-01-31 00:59:59 to the table. It happens to all the hours after the 1159 hours.
According to the Lua PiL book,
%X
implies time (e.g., 23:48:10)
I can not use NOW()
in my query as the time generated by Core.GetUserValue(v, 25)
is a property of PtokaX and is given as User login time in seconds from 1.1.1970.
What can be the problem here? A simple lua code with
print( os.date("%Y-%m-%d %X", 1355586777) )
generates 2012-12-15 21:22:57 as output(where 1355586777 is the value I received from the Core.GetUserValue
call).
I used to have %H:%M:%S
instead of %X
but I thought of using %X
and it seems, I'll have to revert back.