code: public static long millisFromJDBCformat(String param) {
          java.sql.Timestamp sqlTS = java.sql.Timestamp.valueOf(param);
          final long fractionalSecondsInNanos = sqlTS.getNanos();
          // Fractional milliseconds would get truncated so flag them as an error.
          if ((fractionalSecondsInNanos % 1000000) != 0) {
              throw new IllegalArgumentException("Can't convert from String to Date with fractional milliseconds");
          }
          return sqlTS.getTime();
      }
docs: Given a string parseable by the JDBC Timestamp parser, return the fractional component
  in milliseconds.
  
  @param param A timstamp in string format that is parseable by JDBC.
  @return The fraction of a second portion of this timestamp expressed in milliseconds.
  @throws IllegalArgumentException if the timestamp uses higher than millisecond precision.