mx.DateTime formatting, need milliseconds

Discussion in 'Python' started by Troy, Feb 27, 2004.

  1. Troy

    Troy Guest

    Hi-

    I'm running Python 2.3 on Windows so I am using the mx.DateTime
    package to parse timestamps from a log.

    The timestamps are formatted like so:
    2004-02-24 15:42:03,707

    When I use the default formats for the getDateTimeFromString()
    function, I lose the milliseconds. I can't find documentation
    anywhere about how to write a format string for mx.DateTime so I can't
    write my own format string.

    I really need that data. Thanks!

    Troy
    Troy, Feb 27, 2004
    #1
    1. Advertising

  2. Troy wrote:
    > Hi-
    >
    > I'm running Python 2.3 on Windows so I am using the mx.DateTime
    > package to parse timestamps from a log.
    >
    > The timestamps are formatted like so:
    > 2004-02-24 15:42:03,707
    >
    > When I use the default formats for the getDateTimeFromString()
    > function, I lose the milliseconds. I can't find documentation
    > anywhere about how to write a format string for mx.DateTime so I can't
    > write my own format string.
    >
    > I really need that data. Thanks!


    mxDateTime has a strptime() parser that you could use,
    but the Parser.DateTimeFromString() parser should be able
    to parse the above as well (replace ',' with '.').

    --
    Marc-Andre Lemburg
    eGenix.com

    Professional Python Services directly from the Source (#1, Feb 27 2004)
    >>> Python/Zope Consulting and Support ... http://www.egenix.com/
    >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
    >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/

    ________________________________________________________________________

    ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::
    M.-A. Lemburg, Feb 28, 2004
    #2
    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:
    686
    Christos TZOTZIOY Georgiou
    Sep 13, 2003
  2. Tim Peters
    Replies:
    0
    Views:
    520
    Tim Peters
    Sep 9, 2003
  3. mp
    Replies:
    1
    Views:
    374
    John Machin
    Jul 28, 2006
  4. Martin
    Replies:
    0
    Views:
    328
    Martin
    Dec 27, 2008
  5. Replies:
    2
    Views:
    744
    M.-A. Lemburg
    Jan 6, 2009
Loading...

Share This Page