[New-bugs-announce] [issue22321] odd result for datetime.time.strftime("%s")

Dima Tisnek report at bugs.python.org
Mon Sep 1 12:03:22 CEST 2014

New submission from Dima Tisnek:

$ python2 -c 'import datetime; print datetime.time(10, 44, 11).strftime("%s")'

$ python3 -c 'import datetime; print (datetime.time(10, 44, 11).strftime("%s"))'

So apparently, datetime.time(...).strftime("%s") semantically "seconds since unix epoch" assumes Jan 1, 1900 for missing date part.

However datetime module doesn't allow subtracting time objects, i.e. no assumption of date is made, where "same date" chould be reasonable.

components: Extension Modules
messages: 226224
nosy: Dima.Tisnek
priority: normal
severity: normal
status: open
title: odd result for datetime.time.strftime("%s")
type: behavior
versions: Python 2.7, Python 3.4

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list