bigint to timestamp
joncle at googlemail.com
Wed Jan 28 15:05:07 CET 2009
On Jan 28, 1:50 pm, Steve Holden <st... at holdenweb.com> wrote:
> Shah Sultan Alam wrote:
> > Hi Group,
> > I have file with contents retrieved from mysql DB.
> > which has a time field with type defined bigint(20)
> > I want to parse that field into timestamp format(YYYY-MM-DD HH:MM:SS
> > GMT) using python code.
> > The value I found for that field is 212099016004150509
> > Give me sample code that does the conversion.
> Perhaps you could tell us what date and time 212099016004150509 is
> supposed to represent? The classic format is "seconds since the Unix
> epoch" but that isn't what this is:
> >>> time.localtime(212099016004150509)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> ValueError: timestamp out of range for platform time_t
> Neither does it appear to be a MySQL TIME field, since the maximum value
> for that would appear to be
> >>> ((838*60)+59)*60+59
> So, just what is this field? What do the values mean?
> Steve Holden +1 571 484 6266 +1 800 494 3119
> Holden Web LLC http://www.holdenweb.com/
Bit hard to guess without the actual date to compare to... and I'm a
bit busy, but thought I'd throw this in the pool: I'm guessing it's a
MySQL database that's had data put into it via a .NET application
using the .NET DateTime (so a 20 byte int sounds about right IIRC),
which is based on the number of ticks since Jan 1, 1.... I think that
should end up around 2[18ish digits here...]...
More information about the Python-list