This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Documentation for datetime.datetime uses microseconds instead of microsecond
Type: Stage:
Components: Documentation Versions: Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Miquel.Garcia, SilentGhost, docs@python
Priority: normal Keywords:

Created on 2014-05-29 21:03 by Miquel.Garcia, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (3)
msg219366 - (view) Author: Miquel Garcia (Miquel.Garcia) Date: 2014-05-29 21:03
In browsing the documentation for datetime.datetime:

https://docs.python.org/2/library/datetime.html

It states that the datetime.datetime.microseconds returns the number of microseconds but in trying (Python 2.7.1 r271:86832):

import datetime
print datetime.datetime.now().microseconds

The interpreter returns 

AttributeError: 'datetime.datetime' object has no attribute 'microseconds'

The correct way to access the number of microseconds is by:

datetime.datetime.now().microsecond # Note the final 's'

which is not consistent with the documentation.

Many thanks

Miquel
msg219368 - (view) Author: SilentGhost (SilentGhost) * (Python triager) Date: 2014-05-29 21:13
Could you provide an actual quote where it refers to datetime.datetime.microseconds? Are you not by any chance confusing it with datetime.timedelta.microseconds?
msg219370 - (view) Author: Miquel Garcia (Miquel.Garcia) Date: 2014-05-29 21:18
My mistake. Yes you are right, I was confused with the timedelta class. 

Sorry for the confusion. Many thanks!

Miquel
History
Date User Action Args
2022-04-11 14:58:04adminsetgithub: 65808
2014-05-29 21:18:07Miquel.Garciasetstatus: open -> closed
resolution: not a bug
messages: + msg219370
2014-05-29 21:13:36SilentGhostsetnosy: + SilentGhost
messages: + msg219368
2014-05-29 21:03:13Miquel.Garciacreate