def getdate(string_date=None):
 if (not string_date):
  return get_datetime().date()
 if isinstance(string_date, datetime.datetime):
  return string_date.date()
 elif isinstance(string_date, datetime.date):
  return string_date
 if ((not string_date) or (string_date == u'0000-00-00')):
  return None
 return parser.parse(string_date).date()

def getdate ( string_date = None ) : if ( not string_date ) : return get_datetime ( ) . date ( ) if isinstance ( string_date , datetime . datetime ) : return string_date . date ( ) elif isinstance ( string_date , datetime . date ) : return string_date if ( ( not string_date ) or ( string_date == u'0000-00-00' ) ) : return None return parser . parse ( string_date ) . date ( )
coverts string date to datetime .