<div dir="ltr"><div></div>Hi, Mark,<br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Mar 4, 2014 at 1:44 PM, Mark Lawrence <span dir="ltr"><<a href="mailto:breamoreboy@yahoo.co.uk" target="_blank">breamoreboy@yahoo.co.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 04/03/2014 20:57, Igor Korot wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi, ALL,<br>
I'm getting this:<br>
<br>
timestamp out of range for platform localtime()/gmtime() function<br>
<br>
trying to convert the timestamp with milliseconds into the datetime object.<br>
<br>
The first hit of Google gives me this:<br>
<br>
<a href="http://stackoverflow.com/questions/12458595/convert-epoch-timestamp-in-python" target="_blank">http://stackoverflow.com/<u></u>questions/12458595/convert-<u></u>epoch-timestamp-in-python</a><br>
<br>
but the solution described is not good for me since it does not gives<br>
me the milliseconds value.<br>
<br>
How do I get the proper datetime value including milliseconds from the<br>
timestamp?<br>
<br>
Thank you.<br>
<br>
</blockquote>
<br></div></div>
You have a long record of asking timestamp related questions so you should know where the docs are that provide the answer to this question.  I'll leave you to go off and read them.  If you don't understand them, please cut and paste your code here, state what you expected to happen, what actually happened, including any traceback if applicable, and then we'll be happy to point you the error of your ways.<span class="HOEnZb"><font color="#888888"><br>
</font></span></blockquote><div><br></div><div>Working with the dates is not that easy and not just in Python.<br></div><div>There are too many different formatting involved with many different representation.<br></div><div>
And on top of it it is possible to use one system in completely different environment.<br><br></div><div>But this particular question is easy.<br><br></div><div>What I have is a timestamp which reads: 1289410678L.<br><br>
</div><div>Trying to convert this into the datetime object in Python using:<br><br></div><div>import datetime<br></div><div>datetime.datetime.fromtimestamp( stamp )<br><br></div><div>produces the error: timestamp out of range for platform localtime()/gmtime() function.<br>
<br></div><div>This is because this timestamp is not in seconds, but rather in milliseconds.<br><br></div><div>Now the question I have is: how do I properly convert this timestamp into the datetime object with the milliseconds?<br>
<br></div><div>Thank you.<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="HOEnZb"><font color="#888888">
<br>
-- <br>
My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language.<br>
<br>
Mark Lawrence<br>
<br>
---<br>
This email is free from viruses and malware because avast! Antivirus protection is active.<br>
<a href="http://www.avast.com" target="_blank">http://www.avast.com</a><br>
<br>
<br>
-- <br>
<a href="https://mail.python.org/mailman/listinfo/python-list" target="_blank">https://mail.python.org/<u></u>mailman/listinfo/python-list</a><br>
</font></span></blockquote></div><br></div></div>