  Using invariance by fixed-endpoints homotopies and a generalized notion of
symplectic Cayley transform, we prove a product formula for the Conley--Zehnder
index of continuous paths with arbitrary endpoints in the symplectic group. We
discuss two applications of the formula, to the metaplectic group and to
periodic solutions of Hamiltonian systems.
