There's age requirement of 16 to get into Starfleet Academy. I assumed that it would be the same for any Starfleet training program. Tarses said he was eager to get into space and didn't want to spend 4 more years sitting in a classroom. It figures that Tarses would enroll in the Starfleet training program as soon as possible (at 16).
Scotty also mentions in "Relics" to Picard that he's not 18 and that he's not a raw cadet anymore. Scotty professed to Geordi that he may be a captain by rank but all he ever wanted to be was an engineer. If Scotty enrolled in the Starfleet training program at 16 to pursue his engineering career, then 2 years later would put him at 18 and put him in a position to be a "raw cadet" when he entered the Academy. Just 2 flimsy pieces of circumstantial evidence that happened to line up.
As for Command School, we know it's, at least, 1 year as hinted at in "Bread and Circuses." If you want to go further out into left field, there's a line about Cdr. Sulu being in charge of training at Starfleet Command school for 2 years before moving on to be the Captain of the Excelsior in 1997's Star Trek: Starfleet Academy but they may fall into the category of gaming to some rather than an actual filmed movie. Why a 2 year stint of being in charge of training? Could it correlate to the length of a cadet's hitch in command school? Or just a coincidence? The Andorian "cadet" was referred to once as Lieutenant (like Saavik) but all of them were wearing cadet uniforms of the time with 4 pips on their collar like they did as seniors at the Academy in TNG's "First Duty." Lots of circumstantial evidence here that's, unfortunately, not lining up with each other just yet.
Scotty also mentions in "Relics" to Picard that he's not 18 and that he's not a raw cadet anymore. Scotty professed to Geordi that he may be a captain by rank but all he ever wanted to be was an engineer. If Scotty enrolled in the Starfleet training program at 16 to pursue his engineering career, then 2 years later would put him at 18 and put him in a position to be a "raw cadet" when he entered the Academy. Just 2 flimsy pieces of circumstantial evidence that happened to line up.
As for Command School, we know it's, at least, 1 year as hinted at in "Bread and Circuses." If you want to go further out into left field, there's a line about Cdr. Sulu being in charge of training at Starfleet Command school for 2 years before moving on to be the Captain of the Excelsior in 1997's Star Trek: Starfleet Academy but they may fall into the category of gaming to some rather than an actual filmed movie. Why a 2 year stint of being in charge of training? Could it correlate to the length of a cadet's hitch in command school? Or just a coincidence? The Andorian "cadet" was referred to once as Lieutenant (like Saavik) but all of them were wearing cadet uniforms of the time with 4 pips on their collar like they did as seniors at the Academy in TNG's "First Duty." Lots of circumstantial evidence here that's, unfortunately, not lining up with each other just yet.