code: public synchronized String format(long inDate)
      {
          long seconds = inDate / 1000;
  
          // Is it not suitable to cache?
          if (seconds<_lastSeconds ||
              _lastSeconds>0 && seconds>_lastSeconds+__hitWindow)
          {
              // It's a cache miss
              _misses++;
              if (_misses<__MaxMisses)
              {
                  Date d = new Date(inDate);
                  return _tzFormat.format(d);
              }    
          }
          else if (_misses>0)
              _misses--;
                                            
          // Check if we are in the same second
          // and don't care about millis
          if (_lastSeconds==seconds && !_millis)
              return _lastResult;
  
          Date d = new Date(inDate);
          
          // Check if we need a new format string
          long minutes = seconds/60;
          if (_lastMinutes != minutes)
          {
              _lastMinutes = minutes;
              _secFormatString=_minFormat.format(d);
  
              int i;
              int l;
              if (_millis)
              {
                  i=_secFormatString.indexOf("ss.SSS");
                  l=6;
              }
              else
              {
                  i=_secFormatString.indexOf("ss");
                  l=2;
              }
              _secFormatString0=_secFormatString.substring(0,i);
              _secFormatString1=_secFormatString.substring(i+l);
          }
  
          // Always format if we get here
          _lastSeconds = seconds;
          StringBuffer sb=new StringBuffer(_secFormatString.length());
          synchronized(sb)
          {
              sb.append(_secFormatString0);
              int s=(int)(seconds%60);
              if (s<10)
                  sb.append('0');
              sb.append(s);
              if (_millis)
              {
                  long millis = inDate%1000;
                  if (millis<10)
                      sb.append(".00");
                  else if (millis<100)
                      sb.append(".0");
                  else
                      sb.append('.');
                  sb.append(millis);
              }
              sb.append(_secFormatString1);
              _lastResult=sb.toString();
          }
                  
          return _lastResult;
      }
docs: Format a date according to our stored formatter.
  @param inDate
  @return Formatted date