public IntWritable evaluate(Text dateString) {
    if (dateString != null) {
      Date date = DateParser.parseDate(dateString.toString());
      if (date != null) {
        calendar.setTimeInMillis(date.toEpochMilli());
        result.set(calendar.get(Calendar.WEEK_OF_YEAR));
        return result;
      }
    }
    return null;
  }
Get the week of the year 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 53. null if the dateString is not a valid date
        string.
ql/src/java/org/apache/hadoop/hive/ql/udf/UDFWeekOfYear.java