public static String formatDate(Date d) {
    if (timeFormatter == null) {
      try {
        // very simple format that shows millisecond resolution
        return Long.toString(d.getTime());
      } catch (Exception ignore) {
        return "timestampFormatFailed";
      }
    }
    try {
      synchronized (timeFormatter) {
        // Need sync: see bug 21858
        return timeFormatter.format(d);
      }
    } catch (Exception e1) {
      // Fix bug 21857
      try {
        return d.toString();
      } catch (Exception e2) {
        try {
          return Long.toString(d.getTime());
        } catch (Exception e3) {
          return "timestampFormatFailed";
        }
      }
    }
  }
Convert a Date to a timestamp String.

@param d a Date to format as a timestamp String.
@return a String representation of the current time.
geode-core/src/test/java/org/apache/persistence/admin/Logger.java