add a timestamp() method to datetime.date class #103072
Labels
extension-modules
C modules in the Modules dir
stdlib
Python modules in the Lib dir
type-feature
A feature request or enhancement
Feature or enhancement
Extend the datetime.date class with a new method
timestamp()
that mimic the same behavior of datetime.datetime.timestamp, where the time is implicitly"00:00"
.Pitch
At the moment both
datetime.datetime
anddatetime.date
offers thefromtimestamp()
classmethod to convert fromfloat
.datetime.datetime
objects, moreover, offer thetimestamp()
method to convert tofloat
.A similar method lacks for
datetime.date
.Apart from the (lack of) symmetry, there are also some use cases where it's necessary to switch back-and-forth between
datetime.date
s andfloat
s and it would be handy to have some predefined function already.Previous discussion
https://discuss.python.org/t/a-timestamp-method-for-date-objects/13340
Linked PRs
timestamp()
method todatetime.date
#131226The text was updated successfully, but these errors were encountered: