PyLZMA lastwritetime file to python datetime

Discussion in 'Python' started by rabusta, Apr 22, 2011.

  1. rabusta

    rabusta Guest

    How convert lastwritetime file to python datetime?
    rabusta, Apr 22, 2011
    #1
    1. Advertising

  2. rabusta

    Chris Rebert Guest

    On Fri, Apr 22, 2011 at 1:49 AM, rabusta <> wrote:
    > How convert lastwritetime file to python datetime?


    [Mildly educated guess after scanning
    https://github.com/fancycode/pylzma/blob/master/py7zlib.py ]:

    It's likely a Unix timestamp. Perhaps try
    datetime.datetime.utcfromtimestamp() or
    datetime.datetime.fromtimestamp() ?
    http://docs.python.org/library/datetime.html#datetime.datetime.utcfromtimestamp
    http://docs.python.org/library/datetime.html#datetime.datetime.fromtimestamp

    Cheers,
    Chris
    --
    http://blog.rebertia.com
    Chris Rebert, Apr 22, 2011
    #2
    1. Advertising

  3. rabusta

    rabusta Guest

    On Apr 22, 5:12 pm, Chris Rebert <> wrote:
    > [Mildly educated guess after scanninghttps://github.com/fancycode/pylzma/blob/master/py7zlib.py]:
    >
    > It's likely a Unix timestamp. Perhaps try
    > datetime.datetime.utcfromtimestamp() or
    > datetime.datetime.fromtimestamp() ?http://docs.python.org/library/date...ibrary/datetime.html#datetime.datetime.fromti...
    >


    Thanks for the reply!
    but lastwritetime contains 64bit value and function
    datetime.fromtimestamp an error (timestamp out of range for platform
    time_t), I tried to take only the upper 32bit, but it does not
    correspond to the actual date file...

    for example:
    >>> f.header.files.files[0]['lastwritetime']

    14620470108690448384L

    real date: 2010-04-28 06:22:20
    rabusta, Apr 22, 2011
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Christos TZOTZIOY Georgiou
    Replies:
    3
    Views:
    685
    Christos TZOTZIOY Georgiou
    Sep 13, 2003
  2. Tim Peters
    Replies:
    0
    Views:
    517
    Tim Peters
    Sep 9, 2003
  3. Joachim Bauch

    [ANN] PyLZMA 0.0.3

    Joachim Bauch, May 11, 2004, in forum: Python
    Replies:
    0
    Views:
    410
    Joachim Bauch
    May 11, 2004
  4. Joachim Bauch

    ANN: PyLZMA 0.1.0 released

    Joachim Bauch, Oct 23, 2005, in forum: Python
    Replies:
    0
    Views:
    347
    Joachim Bauch
    Oct 23, 2005
  5. dotnet_ottawa
    Replies:
    1
    Views:
    675
    dotnet_ottawa
    Mar 11, 2010
Loading...

Share This Page