def convert_date_input(date_to_convert):
 if date_to_convert:
  try:
   converted_date = datetime.datetime.strptime(date_to_convert, '%m/%d/%Y')
  except:
   raise InvalidDateFormat()
  return converted_date
 else:
  return date_to_convert

def convert_date_input ( date_to_convert ) : if date_to_convert : try : converted_date = datetime . datetime . strptime ( date_to_convert , '%m/%d/%Y' ) except : raise InvalidDateFormat ( ) return converted_date else : return date_to_convert
convert from mm/dd/yyyy to unix timestamp .