public IntWritable evaluate(DateWritableV2 d) {
    if (d == null) {
      return null;
    }

    result.set(d.get().getDayOfWeek());
    return result;
  }
Get the day of week from a date string.

@param dateString
         the dateString in the format of "yyyy-MM-dd HH:mm:ss" or
         "yyyy-MM-dd".
@return an int from 1 to 7. null if the dateString is not a valid date
        string.
ql/src/java/org/apache/hadoop/hive/ql/udf/UDFDayOfWeek.java