Input is: 2011-01-01 Output is: 2011-01-01 00:00:00
How do it get it to output to be: 2011-01-01 ??
# Packages
import datetime
def ObtainDate():
global d
isValid=False
while not isValid:
userInDate = raw_input("Type Date yyyy-mm-dd: ")
try: # strptime throws an exception if the input doesn't match the pattern
d = datetime.datetime.strptime(userInDate, '%Y-%m-%d')
isValid=True
except:
print "Invalid Input. Please try again.\n"
return d
print ObtainDate()
actually not the same as the reference. I'm asking just for the date not the time.