Hi, the title says nearly all I want: How do I convert a datetime.datetime
object (e.g. the return value of datetime.datetime.now())
to a datetime.date object
in Python?
views:
59answers:
3
+1
A:
The documentation is your friend.
Return date object with same year, month and day.
delnan
2010-09-18 19:47:09
A:
You use the datetime.datetime.date()
method:
datetime.datetime.now().date()
Obviously, the expression above can (and should IMHO :) be written as:
datetime.date.today()
ΤΖΩΤΖΙΟΥ
2010-10-17 19:38:06