Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
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?
print date.date()
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')
print date.strftime('%d/%m/%Y')
in your given input format.
Add a comment
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
print date.date()?