Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #51818

Re: outputting time in microseconds or milliseconds

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <skip.montanaro@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.019
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'example:': 0.03; 'column': 0.07; 'cc:addr:python-list': 0.11; 'formatted': 0.16; 'from:addr:pobox.com': 0.16; 'from:addr:skip': 0.16; 'strftime': 0.16; 'sender:addr:gmail.com': 0.17; '(the': 0.22; '>>>': 0.22; 'import': 0.22; 'cc:addr:python.org': 0.22; 'skip': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'rest': 0.29; 'message-id:@mail.gmail.com': 0.30; "skip:' 10": 0.31; 'yes.': 0.31; 'url:python': 0.33; 'subject:time': 0.33; 'third': 0.33; 'skip:d 20': 0.34; 'could': 0.34; 'objects': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'method': 0.36; 'url:org': 0.36; 'url:library': 0.38; 'how': 0.40; 'full': 0.61; 'simple': 0.61; 'more': 0.64; 'to:addr:gmail.com': 0.65; 'details:': 0.80
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=mSAK/Jpppxe9/Z0l3lU+pH7QJP+eLrG490an3BUQeYk=; b=zIDPHFTTZa/GWERsQVDsUEG1I0QK9SOzVWqnNE2luLEtmNbYymQWb5lEzzKyOrgtOh Y36LkvkRurhAjmxhgGi6T+qg3b+98aKpGADSaNiX3rZWhA9SX9aWQphasAJjXIOf0OH7 RmlU2EpqXeMbn+x6i8bzBy+tHq8rgy8qKEQg/iBzl8GWLTwsCVmg48wT04w2+W6VBDpy 3ue1lKIyT6F2okekJeNyqPPW+QZEG+6pSv43MUlM/PyqQ5BNxYJ7pHbJDAdtblVPAS9O 6S8BbKTVWh/RbkKXrykl/PtwxyQ5qixzeVUCC6ARn3UX6RCgFDmYxDfq0pTYx1TcT2Lt ZVMA==
MIME-Version 1.0
X-Received by 10.43.14.74 with SMTP id pp10mr666976icb.87.1375456553291; Fri, 02 Aug 2013 08:15:53 -0700 (PDT)
Sender skip.montanaro@gmail.com
In-Reply-To <3e3f0032-3b3b-4c50-99b1-8db3676fb993@googlegroups.com>
References <b5df0633-c6fe-4489-adda-5b9f270a904d@googlegroups.com> <mailman.119.1375447068.1251.python-list@python.org> <3e3f0032-3b3b-4c50-99b1-8db3676fb993@googlegroups.com>
Date Fri, 2 Aug 2013 10:15:53 -0500
X-Google-Sender-Auth _sJb0w4NwcNNtCs2AHMGaWoMPHA
Subject Re: outputting time in microseconds or milliseconds
From Skip Montanaro <skip@pobox.com>
To matt.doolittle33@gmail.com
Content-Type text/plain; charset=UTF-8
Cc Python <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.128.1375456557.1251.python-list@python.org> (permalink)
Lines 21
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1375456557 news.xs4all.nl 15963 [2001:888:2000:d::a6]:37395
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:51818

Show key headers only | View raw


> is the third column is only the microsecond?

Yes.

> how could i get this to write with the rest of the time (the hh:mm:ss) ?

It sounds like you really want the time formatted in a particular way,
not just the numeric value of one or more fields.  Look at the
documentation for the strftime method of datetime objects for full
details:

http://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior

Here's a simple example:

>>> import datetime
>>> now = datetime.datetime.now()
>>> now.strftime("%H:%M:%S.%f")
'10:14:36.526110'

Skip

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

outputting time in microseconds or milliseconds matt.doolittle33@gmail.com - 2013-08-02 03:54 -0700
  Re: outputting time in microseconds or milliseconds Dave Angel <davea@davea.name> - 2013-08-02 12:08 +0000
  Re: outputting time in microseconds or milliseconds Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2013-08-02 13:59 +0200
    Re: outputting time in microseconds or milliseconds matt.doolittle33@gmail.com - 2013-08-02 06:17 -0700
      Re: outputting time in microseconds or milliseconds Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2013-08-05 08:15 +0200
  Re: outputting time in microseconds or milliseconds Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-02 12:35 +0000
    Re: outputting time in microseconds or milliseconds matt.doolittle33@gmail.com - 2013-08-02 08:09 -0700
  Re: outputting time in microseconds or milliseconds Skip Montanaro <skip@pobox.com> - 2013-08-02 07:37 -0500
    Re: outputting time in microseconds or milliseconds matt.doolittle33@gmail.com - 2013-08-02 07:18 -0700
      Re: outputting time in microseconds or milliseconds Skip Montanaro <skip@pobox.com> - 2013-08-02 10:15 -0500
  Re: outputting time in microseconds or milliseconds Chris Angelico <rosuav@gmail.com> - 2013-08-02 13:50 +0100
  Re: outputting time in microseconds or milliseconds matt.doolittle33@gmail.com - 2013-08-04 04:30 -0700
    Re: outputting time in microseconds or milliseconds Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2013-08-04 13:57 +0200
    Re: outputting time in microseconds or milliseconds Dave Angel <davea@davea.name> - 2013-08-04 13:38 +0000
    Re: outputting time in microseconds or milliseconds Roy Smith <roy@panix.com> - 2013-08-04 10:33 -0400
      Re: outputting time in microseconds or milliseconds matt.doolittle33@gmail.com - 2013-08-07 19:51 -0700
        Re: outputting time in microseconds or milliseconds Skip Montanaro <skip@pobox.com> - 2013-08-08 07:03 -0500
          Re: outputting time in microseconds or milliseconds Roy Smith <roy@panix.com> - 2013-08-08 09:30 -0400

csiph-web