Of course , the amount of time you should spend in St Petersburg depends on your interests, but I would say that you need at least 6-7 days to visit the main attractions of the city and make 2 day- trips to its suburbs like Peterhof or Pushkin. Of course, you will need to stay in St Petersburg for several weeks if you want to see ancient Russian town like Novgorod, take a cruise to Valaam monastery, visit Kizhi open-air museum or simply explore not that overcrowded but beautiful places around St Pete like Gatchina, Kronstadt, Lomonosov or may be even Vyborg.
To make the things more clear, the main attractions of St Petersburg are mostly situated in the city center and you may reach most of them on foot during the day( though there will be a lot of walking and you won’t have time to go inside many museums).
You will spend half a day at the Hermitage ( you will be overwhelmed by what you see after 3, maximum 4 hours, so it’s better to come back another day). If you like museums, you will need 3-4 days only for the city itself.
But there are also suburbs: though Peterhof and Pushkin are overcrowded with tourists, they are absolute musts for a first-time visitor. Reserve one day for Peterhof and at least half a day for Pushkin ( you can visit another suburb, Pavlovsk, the same day as it is very close).