Converting a time string to a more readable date, time

Benjamin Kaplan benjamin.kaplan at case.edu
Mon Oct 27 17:04:48 EDT 2008


On Mon, Oct 27, 2008 at 4:45 PM, Thierry Lam <lamthierry at gmail.com> wrote:

> I have a python time string which has the following value:
>
> 1225137896
>
> The above corresponds to 2008/10/27 16:04:56
>
> What can I use to convert 1225137896 to a more readable date, time
> format?
> --


>>> from datetime import datetime
>>> d = datetime.fromtimestamp(1225137896)
>>> print d
2008-10-27 16:04:56
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20081027/324d2f22/attachment-0001.html>


More information about the Python-list mailing list