It is maximum 8 hours by train. It is a pleasant journey when you take the night train from St.Petrsburg around 11pm and you arrive in Moscow around 7am.
It would take between 12 and 13 hours to drive the 800km distance between Moscow and Saint Petersburg.
About an hour by plane, or about 8 hours by limited express train.
St. Petersburg is not Moscow. St. Petersburg is a separate and quite unique city that sits quite away from Russia's capital.
9 hours
St. Petersburg is the name of a city and not a saint.