def str_to_datetime(date: str, format='%Y-%m-%d %H:%M:%S'):
    """
    Convert string back to datetime

    @Args:
    * [date] str, the input string in some date format
    * [format] str, default is YYYY-mm-dd HH:MM:SS

    @Returns:
    * [datetime] returning is a datetime type
    """
    from datetime import datetime
    if date is not None:
        return datetime.strptime(date, format)
    else:
        return datetime.strptime('1970-01-01 00:00:00', format)
