human
Write me a Python function to parse string to date fromat in the Python function.
assistant
Here is a Python function to parse string to date fromat the date

import datetime

def parse_date(date_str):
  """Parses a date string into a datetime object."""
  return datetime.datetime.strptime(date_str, "%Y-%m-%d")

# Enter the date string
date_str = "2018-01-01"

# Calling the function
print((parse_date(date_str)))

#Example Output
# 2018-01-01 00:00:00

#Remember to inspect code for bugs.