The appellant seeks review of the sentences imposed pursuant to the revocation of his probation. We affirm the judgments but remand the case for correction of the sentences.
In 1973, the appellant was placed on probation for two offenses. His probation was properly revoked in 1979, and he was adjudicated guilty of both offenses.
*206The trial judge retained jurisdiction over the first third of the sentence he imposed for the breaking and entering offense pursuant to the authority of section 947.-16(3), Florida Statutes (1981). That statute was enacted in 1978. In State v. Williams, 397 So.2d 663 (Fla.1981), our supreme court made it clear that the statute could not be applied to offenses, such as those committed by the appellant, which occurred before its enactment. Rodriguez v. State, 380 So.2d 1123 (Fla. 2d DCA 1980). Therefore, that portion of the sentence pertaining to the trial court’s retention of jurisdiction should be stricken.
The five year sentence imposed for the robbery offense did not credit appellant for time served in county jail in Florida prior to imposition of sentence. A sentencing court is required under section 921.161, Florida Statutes (1981), to credit a defendant with all time spent in county jail before sentence. Broxson v. State, 402 So.2d 570 (Fla. 1st DCA 1981). Although the appellant’s sentence for robbery was made to run concurrently with a sentence appellant was then serving in Pennsylvania, the sentence specifically provides that the appellant be returned to Florida to complete any remaining time after serving the Pennsylvania sentence. Therefore, the appellant should have been credited for time spent in county jail prior to the imposition of the Florida robbery sentence.
Accordingly, appellant’s convictions are affirmed, but the cause is remanded to correct his sentences in accordance with this opinion.
OTT, C.J., and BOARDMAN and DAN-AHY, JJ., concur.