@Nullable public static Date stringToDate(@NonNull String dateAsString,@NonNull DateFormat df){
  try {
    df.setTimeZone(UTC);
    return df.parse(dateAsString);
  }
 catch (  ParseException e) {
    return null;
  }
}

@ Nullable public static Date stringToDate ( @ NonNull String dateAsString , @ NonNull DateFormat df ) { try { df . setTimeZone ( UTC ) ; return df . parse ( dateAsString ) ; } catch ( ParseException e ) { return null ; } }
converts a string representation of a date to its date object .
