[Tutor] Timestamp issues when importing from FireFox sqlite field
Paul Smith
paulrsmith7777 at gmail.com
Mon Jul 15 22:27:41 CEST 2013
All-
Newb here so apologies upfront.
Attempting timestamp translation via python importing info from sqlite
datetime item in firefox ,'1369751000393000'. Typical unix date time
translation fails. I noted micro second addition but even
'1369751000393000' / 1e6 does not get a chew-able range, at least in python
datetime module. Any suggestions?
Best regards,
Paul
Failing code examples:
>>> import datetime
>>> print
datetime.datetime.fromtimestamp(int("1369751000393000")).strftime('%Y-%m-%d
%H:%M:%S')
Traceback (most recent call last):
File "<pyshell#11>", line 1, in <module>
print
datetime.datetime.fromtimestamp(int("1369751000393000")).strftime('%Y-%m-%d
%H:%M:%S')
ValueError: timestamp out of range for platform localtime()/gmtime()
function
microseconds /1e6?
>>> import datetime
>>> print
datetime.datetime.fromtimestamp(int("1369751000393000/1e6")).strftime('%Y-%m-%d
%H:%M:%S')
Traceback (most recent call last):
File "<pyshell#18>", line 1, in <module>
print
datetime.datetime.fromtimestamp(int("1369751000393000/1e6")).strftime('%Y-%m-%d
%H:%M:%S')
ValueError: invalid literal for int() with base 10: '1369751000393000/1e6'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130715/b91da0f8/attachment.html>
More information about the Tutor
mailing list