human
Convert a string to datetime object in python
assistant
Here is some code to parse string `datestr` into a datetime object using format pattern '%Y-%m-%d'

dateobj = datetime.datetime.strptime(datestr, '%Y-%m-%d').date()

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.