code: static double fromDate(Date dt) {
  
          // the number of milliseconds since January 1, 1970, 00:00:00 GMT
          long t = dt.getTime();
  
          // the number of milliseconds since January 1, 1970, 00:00:00 Local Time
          Calendar c = new GregorianCalendar();
          c.setTime(dt);
          t += (c.get(Calendar.ZONE_OFFSET) + c.get(Calendar.DST_OFFSET)) ;
  
          // the number of milliseconds since December 30, 1899, 00:00:00 Local Time
          t += 2209161600000L;
  
          // DATE is an offset from "30 December 1899"
          if (t < 0) {
              // -0.3 -> -0.7
              long offset = -(t % MSPD);    // TODO: check
              t = t - MSPD + offset;
          }
          double d = ((double) t) / MSPD;
          return d;
      }
docs: Opposite of the {@link #toDate(double)} method.