Proper conversion of timestamp

2014-03-04 Thread Igor Korot
Hi, ALL, I'm getting this: timestamp out of range for platform localtime()/gmtime() function trying to convert the timestamp with milliseconds into the datetime object. The first hit of Google gives me this: http://stackoverflow.com/questions/12458595/convert-epoch-timestamp-in-python but the

Re: Proper conversion of timestamp

2014-03-04 Thread MRAB
On 2014-03-04 20:57, Igor Korot wrote: Hi, ALL, I'm getting this: timestamp out of range for platform localtime()/gmtime() function trying to convert the timestamp with milliseconds into the datetime object. The first hit of Google gives me this:

Re: Proper conversion of timestamp

2014-03-04 Thread Mark Lawrence
On 04/03/2014 20:57, Igor Korot wrote: Hi, ALL, I'm getting this: timestamp out of range for platform localtime()/gmtime() function trying to convert the timestamp with milliseconds into the datetime object. The first hit of Google gives me this:

Re: Proper conversion of timestamp

2014-03-04 Thread Igor Korot
MRAB, On Tue, Mar 4, 2014 at 1:38 PM, MRAB pyt...@mrabarnett.plus.com wrote: On 2014-03-04 20:57, Igor Korot wrote: Hi, ALL, I'm getting this: timestamp out of range for platform localtime()/gmtime() function trying to convert the timestamp with milliseconds into the datetime object.

Re: Proper conversion of timestamp

2014-03-04 Thread Mark Lawrence
On 04/03/2014 21:38, MRAB wrote: On 2014-03-04 20:57, Igor Korot wrote: Hi, ALL, I'm getting this: timestamp out of range for platform localtime()/gmtime() function trying to convert the timestamp with milliseconds into the datetime object. The first hit of Google gives me this:

Re: Proper conversion of timestamp

2014-03-04 Thread Igor Korot
Mark, On Tue, Mar 4, 2014 at 1:45 PM, Mark Lawrence breamore...@yahoo.co.ukwrote: On 04/03/2014 21:38, MRAB wrote: On 2014-03-04 20:57, Igor Korot wrote: Hi, ALL, I'm getting this: timestamp out of range for platform localtime()/gmtime() function trying to convert the timestamp with

Re: Proper conversion of timestamp

2014-03-04 Thread Igor Korot
Hi, Mark, On Tue, Mar 4, 2014 at 1:44 PM, Mark Lawrence breamore...@yahoo.co.ukwrote: On 04/03/2014 20:57, Igor Korot wrote: Hi, ALL, I'm getting this: timestamp out of range for platform localtime()/gmtime() function trying to convert the timestamp with milliseconds into the datetime

Re: Proper conversion of timestamp

2014-03-04 Thread Chris Angelico
On Wed, Mar 5, 2014 at 8:46 AM, Igor Korot ikoro...@gmail.com wrote: Are you using Python 2? If yes, then try dividing by 1000.0. Yes, I'm using python 2.7. But dividing by 1000 will give the precision in seconds, i.e. -MM-DD HH:MM:SS. Did you notice the bit at the end there? Try

Re: Proper conversion of timestamp

2014-03-04 Thread Chris Angelico
On Wed, Mar 5, 2014 at 8:55 AM, Igor Korot ikoro...@gmail.com wrote: This is because this timestamp is not in seconds, but rather in milliseconds. Now the question I have is: how do I properly convert this timestamp into the datetime object with the milliseconds? Read elsewhere in the

Re: Proper conversion of timestamp

2014-03-04 Thread Ethan Furman
On 03/04/2014 01:55 PM, Igor Korot wrote: Now the question I have is: how do I properly convert this timestamp into the datetime object with the milliseconds? And Mark's point is: How do the docs say to do it? What fails when you try it that way? -- ~Ethan~ --

Re: Proper conversion of timestamp

2014-03-04 Thread Mark Lawrence
On 04/03/2014 21:55, Igor Korot wrote: But this particular question is easy. If it's easy why can't you answer it via the docs rather than ask here? -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence --- This email is

Re: Proper conversion of timestamp

2014-03-04 Thread MRAB
On 2014-03-04 21:55, Igor Korot wrote: Hi, Mark, On Tue, Mar 4, 2014 at 1:44 PM, Mark Lawrence breamore...@yahoo.co.uk mailto:breamore...@yahoo.co.uk wrote: On 04/03/2014 20:57, Igor Korot wrote: Hi, ALL, I'm getting this: timestamp out of range for platform

Re: Proper conversion of timestamp

2014-03-04 Thread Igor Korot
Hi, Mark, On Tue, Mar 4, 2014 at 2:46 PM, Mark Lawrence breamore...@yahoo.co.uk wrote: On 04/03/2014 21:55, Igor Korot wrote: But this particular question is easy. If it's easy why can't you answer it via the docs rather than ask here? What I meant to say is: it is easy for all you people

Re: Proper conversion of timestamp

2014-03-04 Thread Igor Korot
MRAB, On Tue, Mar 4, 2014 at 4:42 PM, MRAB pyt...@mrabarnett.plus.com wrote: On 2014-03-04 21:55, Igor Korot wrote: Hi, Mark, On Tue, Mar 4, 2014 at 1:44 PM, Mark Lawrence breamore...@yahoo.co.uk mailto:breamore...@yahoo.co.uk wrote: On 04/03/2014 20:57, Igor Korot wrote:

Re: Proper conversion of timestamp

2014-03-04 Thread Ben Finney
Igor Korot ikoro...@gmail.com writes: On Tue, Mar 4, 2014 at 4:42 PM, MRAB pyt...@mrabarnett.plus.com wrote: But this particular question is easy. What I have is a timestamp which reads: 1289410678L. That's an integer. It looks like the timestamp is a whole number of seconds, so the

Re: Proper conversion of timestamp

2014-03-04 Thread Mark Lawrence
On 05/03/2014 02:13, Igor Korot wrote: Hi, Mark, On Tue, Mar 4, 2014 at 2:46 PM, Mark Lawrence breamore...@yahoo.co.uk wrote: On 04/03/2014 21:55, Igor Korot wrote: But this particular question is easy. If it's easy why can't you answer it via the docs rather than ask here? What I

Re: Proper conversion of timestamp

2014-03-04 Thread Gregory Ewing
Igor Korot wrote: What I have is a timestamp which reads: 1289410678L. Trying to convert this into the datetime object in Python using: import datetime datetime.datetime.fromtimestamp( stamp ) produces the error: timestamp out of range for platform localtime()/gmtime() function. Divide the

Re: Proper conversion of timestamp

2014-03-04 Thread MRAB
On 2014-03-05 02:33, Ben Finney wrote: Igor Korot ikoro...@gmail.com writes: On Tue, Mar 4, 2014 at 4:42 PM, MRAB pyt...@mrabarnett.plus.com wrote: But this particular question is easy. What I have is a timestamp which reads: 1289410678L. That's an integer. It looks like the timestamp is