Sunday, May 30, 2010

Python notes - Timestamp to Datetime

>>> import datetime
>>> import time
>>> time.time()
1275242762.4052529
>>> int(time.time())
1275242769
>>> n=int(time.time())
>>> print datetime.datetime.fromtimestamp(n)
2010-05-30 20:06:20

No comments:

 

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.