Appellant, defendant below, appeals from the trial court’s order adjudicating him guilty of burglary of a structure and sentencing him to two years in the state *192prison to be followed by three years probation.
The defendant argues that his sentence is illegal under Villery v. Florida Parole & Probation Commission, 396 So.2d 1107 (Fla.1981) and also asserts that he was not given credit on the sentencing order for one day of time served contrary to section 921.-161(1), Florida Statutes (1979). We agree.
The sentence is illegal under Villery. Although the judge did recommend that the defendant be treated under chapter 917, Florida Statutes, in a minimum security facility for the two years he was sentenced to imprisonment, the defendant would not be eligible for treatment under chapter 917 as he was not convicted of a sexual offense. As a result, the defendant is sentenced to imprisonment for two years to be followed by three years probation, a sentence patently illegal under Villery.
Accordingly, the defendant’s illegal sentence is stricken and the case is remanded to the trial court so that the defendant may be resentenced in accordance with this court’s opinion in Lewis v. State, 402 So.2d 482, (Fla.2d DCA, 1981).
The defendant also must be given credit for time served on the sentencing order as required by section 921.161(1). The trial court is directed to give credit for time served on the order when the judge resen-tences the defendant to rectify the Villery problem.
The conviction is affirmed but the sentence is stricken and the cause is remanded for resentencing.
REMANDED.
SCHEB, C. J., and DANAHY and CAMPBELL, JJ., concur.