import datetime #str -> date detester = '2017-01-01' date = datetime.datetime.strptime(detester,'%Y-%m-%d') #date -> str date = datetime.now() detester = date.strftime('%Y-%m-%d')