I am converting a string to date like this:
date=request.GET.get('date','')
if date:
date = datetime.strptime(date, "%m/%d/%Y")
print date
This prints:
2014-08-08 00:00:00
How can I get the date without the 00:00:00 time?
You have a "datetime" object, hence the time part.
As @jonrsharpe mentioned in his comment, it's
print date.date()
(output in ISO format)
or print date.strftime('%d/%m/%Y')
in your given input format.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With