public static Date stringToDate(String dateAsString){
  try {
    DateFormat df=new SimpleDateFormat(dateFormat);
    df.setTimeZone(utc);
    return df.parse(dateAsString);
  }
 catch (  ParseException e) {
    return null;
  }
catch (  NullPointerException e) {
    return null;
  }
}

public static Date stringToDate ( String dateAsString ) { try { DateFormat df = new SimpleDateFormat ( dateFormat ) ; df . setTimeZone ( utc ) ; return df . parse ( dateAsString ) ; } catch ( ParseException e ) { return null ; } catch ( NullPointerException e ) { return null ; } }
converts a string representation of a date to its respective date object .
