protected long trunc(long input, int scale) {
    return trunc(BigDecimal.valueOf(input), scale).longValue();
  }
GenericUDFTrunc.

Returns the first day of the month which the date belongs to. The time part of the date will be
ignored.
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFTrunc.java