public void writeDate(DateWritableV2 date) throws IOException {
    if (date == null) {
      EndianUtils.writeSwappedInteger(this, 0);
      return;
    }
    int toWrite = date.get().getYear() * 10000 + date.get().getMonth() * 100 + date.get().getDay() - 19000000;
    EndianUtils.writeSwappedInteger(this, toWrite);
  }
Write DATE.
The representation of date in Teradata binary format is:
The Date D is a int with 4 bytes using little endian.
The representation is (YYYYMMDD - 19000000).toInt -&gt; D
eg. 1911.11.11 -&gt; 19111111 -&gt; 111111 -&gt; 07 b2 01 00 in little endian.
the null date will use 0 to pad.

@param date the date
@throws IOException the io exception
serde/src/java/org/apache/hadoop/hive/serde2/teradata/TeradataBinaryDataOutputStream.java