bigint to timestamp

Steve Holden steve at holdenweb.com
Wed Jan 28 08:50:58 EST 2009


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.
> 
Please?

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
3020399

So, just what is this field? What do the values mean?

regards
 Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/




More information about the Python-list mailing list