public boolean matches(String dayOfWeek) {
      if (dayOfWeek.length() == 2) {
        return name2.equalsIgnoreCase(dayOfWeek);
      }
      if (dayOfWeek.length() == 3) {
        return name3.equalsIgnoreCase(dayOfWeek);
      }
      return fullName.equalsIgnoreCase(dayOfWeek);
    }
GenericUDFNextDay.

Returns the first date which is later than start_date and named as indicated
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFNextDay.java