code: public static int encodeDate(long javaDateTime) {
          Calendar cal = Calendar.getInstance();
          cal.setTimeInMillis(javaDateTime);
          return 512 * (cal.get(Calendar.YEAR) - 1980) + 32 * (cal.get(Calendar.MONTH) + 1) +
                  cal.get(Calendar.DATE);
      }
docs: Encode a java date/time into a 16-bit encoded DOS date
  
  @param javaDateTime
  @return long