Sto cercando di convertire un lungo per una data:Python convertire lungo fino ad oggi
class timeStamp(object):
def getDateTime(self,longDate):
myNumber = float(longDate)
return str(datetime.datetime.fromtimestamp(time.ctime(myNumber)).strftime('%Y-%m-%d %H:%M:%S'))
Ma ho un errore di strano:
File "./index.py", line 104, in getDateTime
return str(datetime.datetime.fromtimestamp(time.ctime(myNumber)).strftime('%Y-%m-%d %H:%M:%S'))
TypeError: a float is required
Perché è lamentano quando sono esplicitamente giuso galleggiare? Il lungo è un timestamp Unix memorizzato come un lungo in mysql.