def iso_string_to_python_datetime ( isostring : str ) -> Optional [ datetime . datetime ] : if not isostring : return None # if you parse() an empty string, you get today's date return dateutil . parser . parse ( isostring )
python get date from string without datetime
Takes an ISO - 8601 string and returns a datetime .
def iso_string_to_python_datetime(
        isostring: str) -> Optional[datetime.datetime]:
    """
    Takes an ISO-8601 string and returns a ``datetime``.
    """
    if not isostring:
        return None  # if you parse() an empty string, you get today's date
    return dateutil.parser.parse(isostring)