Jun-19-2023, 11:51 AM
Why not simply use the
.date()
method?from datetime import datetime today = datetime.today() date = today.date() print(today, type(today)) print(date, type(date)) date = str(date) print(date, type(date))
Output:2023-06-19 13:01:48.271420 <class 'datetime.datetime'>
2023-06-19 <class 'datetime.date'>
2023-06-19 <class 'str'>
Sig:
>>> import this
The UNIX philosophy: "Do one thing, and do it well."
"The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse
"Everything should be made as simple as possible, but not simpler." :~ Albert Einstein
>>> import this
The UNIX philosophy: "Do one thing, and do it well."
"The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse
"Everything should be made as simple as possible, but not simpler." :~ Albert Einstein