human
Python -Remove Time from Datetime String
assistant
Here is some code to format a datetime string `when` to extract date only

then = datetime.datetime.strptime(when, '%Y-%m-%d').date()

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