[issue32522] Add precision argument to datetime.now
STINNER Victor
report at bugs.python.org
Tue Jan 9 10:56:42 EST 2018
STINNER Victor <victor.stinner at gmail.com> added the comment:
> dt = datetime.now(precision='day')
Why not creating a date and then convert it to a datetime object?
> dt = datetime.now().replace(microseconds=0)
Yeah, that one annoys me as well, but I learnt the .replace(microseconds=0) hack, or how to format without microseconds.
By the way, are you aware of Python 3.7 enhancement of .isoformat(), the new timespec parameter?
https://docs.python.org/dev/library/datetime.html#datetime.datetime.isoformat
----------
nosy: +vstinner
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32522>
_______________________________________
More information about the Python-bugs-list
mailing list