outputting time in microseconds or milliseconds
matt.doolittle33 at gmail.com
matt.doolittle33 at gmail.com
Fri Aug 2 10:18:54 EDT 2013
On Friday, August 2, 2013 8:37:45 AM UTC-4, Skip Montanaro wrote:
> Perhaps use datetime?
>
>
>
> >>> now = datetime.datetime.now()
>
> >>> now.isoformat()
>
> '2013-08-02T07:37:08.430131'
>
> >>> now.strftime("%f")
>
> '430131'
>
>
>
> Skip
Thanks Skip, what i currently i have is:
dt = datetime.now()
and
self.logfile.write('%s\t'%(str(strftime("%Y-%m-%d", ))))
self.logfile.write('%s\t'%(str(strftime("%H:%M:%S", ))))
self.logfile.write('%s\t'%(str(dt.microsecond)))
what i get is this:
2013-08-02 09:52:20 312961
2013-08-02 09:52:20 313274
2013-08-02 09:52:20 313461
2013-08-02 09:52:20 313580
2013-08-02 09:52:20 498705
2013-08-02 09:52:20 508610
2013-08-02 09:52:20 508963
2013-08-02 09:52:20 509191
2013-08-02 09:52:20 509477
2013-08-02 09:52:20 509703
2013-08-02 09:52:20 509798
2013-08-02 09:52:20 509887
2013-08-02 09:52:20 509975
2013-08-02 09:52:20 511013
2013-08-02 09:52:20 511112
2013-08-02 09:52:20 678554
2013-08-02 09:52:20 687994
2013-08-02 09:52:20 688291
2013-08-02 09:52:20 688519
2013-08-02 09:52:20 688740
2013-08-02 09:52:20 688963
is the third column is only the microsecond? how could i get this to write with the rest of the time (the hh:mm:ss) ?
More information about the Python-list
mailing list