datetime - Python timestamps with time() -


i have few timestamps in database trim down 10 timestamps, latest oldest. timestamps in db made using time() in python.

create timestamp:

_timestamp = time.time() 

timestamps:

1435652632.92778 1435652633.01 1435652633.07 1435652633.13 1435652642.71371 1435652642.77 1435652675.13 1435652675.22 1435652717.74 1435652735.11 1435652735.16 1435652735.24 

how can ask python remove oldest timestamp?

i convert timestamp readable format using below string in script.

print datetime.datetime.fromtimestamp(1434615010.27858) >>2015-06-18 08:10:10.278580 

i have no code yet remove oldest timestamps, appreciate please.

this epoch timestamp seconds passed since 1970-01-01t00:00:00z.

in case, sort timestmaps , take 10 top elements.

timestmaps = [1435652632.92778, 1435652633.01, 1435652633.07] timestmaps.sort(reverse=true) latesttimestamps = timestmaps[:10] 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -