#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2005
    Location
    NIPPON
    Posts
    15
    Rep Power
    0

    how to get timespamp


    how can you get the timestamp down to milli-seconds with
    Python ?
  2. #2
  3. Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Dec 2004
    Location
    Meriden, Connecticut
    Posts
    1,797
    Rep Power
    155
    I'm not sure if you can get it with ms, but here's normal time.
    import time
    time.strftime("%I:%M:%S %p")
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2005
    Posts
    6
    Rep Power
    0
    I'm sure you could do it using this object
    http://docs.python.org/lib/datetime-time.html

    and a bit of fiddling
  6. #4
  7. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    You could use time.time() to get the number of seconds as a floating point number since the Epoch, then extract the milliseconds from that. Something like this should work:

    Code:
    >>> import time
    >>> theTime = time.time()
    >>> theTime
    1110924571.1189401
    >>> theTime - int(theTime)
    0.11894011497497559
    >>>
    Hope this helps,

    Mark.
    programming language development: www.netytan.com Hula

  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2005
    Location
    NIPPON
    Posts
    15
    Rep Power
    0
    Originally Posted by netytan
    You could use time.time() to get the number of seconds as a floating point number since the Epoch, then extract the milliseconds from that. Something like this should work:

    Code:
    >>> import time
    >>> theTime = time.time()
    >>> theTime
    1110924571.1189401
    >>> theTime - int(theTime)
    0.11894011497497559
    >>>
    Hope this helps,

    Mark.
    it did help good . thanks.

IMN logo majestic logo threadwatch logo seochat tools logo