code: public static long toPackedDate(long mjd) {
  
          long y;
          int m;
          int d;
  
          long days = MathUtils.safeAdd(mjd, OFFSET);
  
          long q4 = MathUtils.floorDivide(days, 1461);
          int r4 =  MathUtils.floorModulo(days, 1461);
  
          if (r4 == 1460) {
              y = (q4 + 1) * 4;
              m = 2;
              d = 29;
          } else {
              int q1 = (r4 / 365);
              int r1 = (r4 % 365);
  
              y = q4 * 4 + q1;
              m = (((r1 + 31) * 5) / 153) + 2;
              d = r1 - (((m + 1) * 153) / 5) + 123;
  
              if (m > 12) {
                  y++;
                  m -= 12;
              }
          }
  
          if (y < JulianMath.MIN_YEAR || y > JulianMath.MAX_YEAR) {
              throw new IllegalArgumentException("Year out of range: " + y);
          }
  
          long result = (y << 32);
          result |= (m << 16);
          result |= d;
          return result;
  
      }
docs: /*[deutsch]
  <p>Berechnet das gepackte Datum auf Basis des angegebenen
  modifizierten julianischen Datums. </p>
  
  <p>Mit Hilfe von {@code readYear()}, {@code readMonth()} und
  {@code readDayOfMonth()} k&ouml;nnen aus dem Ergebnis die einzelnen
  Datumselemente extrahiert werden. </p>
  
  @param   mjd         days since [1858-11-17] (modified julian date)
  @return  packed date in binary format
  @throws  IllegalArgumentException if the calculated year is not in
  range [(-999999999)-999999999)]
  @see     #readYear(long)
  @see     #readMonth(long)
  @see     #readDayOfMonth(long)