public static void setDateWritable(Object dwHive, long epoch, TimeZone tz) {
    try {                                // Hive 3.1 and above
      Class<?> dtClazz = Class.forName("org.apache.hadoop.hive.common.type.Date");
      Class<?> dwClazz = Class.forName("org.apache.hadoop.hive.serde2.io.DateWritableV2");
      Method dtSetImpl = dtClazz.getMethod("setTimeInMillis", long.class);
      Method dwSetImpl = dwClazz.getMethod("set", dtClazz);
      Object dtObj = dtClazz.getConstructor().newInstance();
      dtSetImpl.invoke(dtObj, epoch);
      dwSetImpl.invoke(dwHive, dtObj);
    } catch (Exception e1) {
      try {                            // Hive 0.12 and above
        Class<?> dwClazz = Class.forName("org.apache.hadoop.hive.serde2.io.DateWritable");
        Method dwSetImpl = dwClazz.getMethod("set", java.sql.Date.class);
        dwSetImpl.invoke(dwHive, new java.sql.Date(epoch));
      } catch (Exception e2) {              // Hive 0.11 and below
        // column type DATE not supported
        throw new UnsupportedOperationException("DATE type");
      }
    }
  }
Type DATE was introduced in Hive-0.12 - class DateWritable in API.
Class DateWritableV2 is used instead as of Hive-3.1 version.
ql/src/java/org/apache/hadoop/hive/ql/udf/esri/shims/HiveShims.java