How to use mysql FROM_UNIXTIME in python -
i want execute sql:
sql = "select from_unixtime(time,'%h') aaa" but generates following error message:
not enough arguments format string i've found answers,which recommend me change '%' '%%',but have use symbol in sql. how solve this?
i believe problem format argument in
from_unixtime(time,'%h') mysql from_unixtime() returns date /datetime version of unix_timestamp. return value in ‘yyyyy-mm-dd hh:mm:ss’ format or yyyymmddhhmmss.uuuuuu format depending upon context of function ( whether numeric or string). if specified, result formatted according given format string.
so means '%h' invalid. should choose between:
- 'yyyyy-mm-dd hh:mm:ss'
- yyyymmddhhmmss.uuuuuu
some examples:
http://www.w3resource.com/mysql/date-and-time-functions/mysql-from_unixtime-function.php
Comments
Post a Comment