[issue17267] datetime.time support for '+' and 'now'

Ronald Oussoren report at bugs.python.org
Thu Feb 21 13:47:59 CET 2013


New submission from Ronald Oussoren:

It would be nice if datetime.time would be possible to add a delta to a datetime.time object, and if datetime.time had a method for returning the current time (just like datetime.date and date time.datetime have 'today' and 'now' methods).

Rationale for the '+' operator: calculating the wall clock time some time after an time on an unspecified date. The easy solution would be:

   tm = datetime.time(13, 20)
   later = tm + datetime.timedelta(hours=5, minutes=44)

That's is currently not possible, but requires more complicated code.

Getting the current time without date information currently requires getting done with 'datetime.datetime.now().time()', a class method of 'datetime.time' would IMHO be nicer. I must admit that I don't have a good suggestion for the name of that method.

----------
components: Library (Lib)
messages: 182592
nosy: ronaldoussoren
priority: normal
severity: normal
stage: test needed
status: open
title: datetime.time support for '+' and 'now'
type: enhancement
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17267>
_______________________________________


More information about the Python-bugs-list mailing list