
342 N.W.2d 858 (1984)
STATE of Iowa, Appellee,
v.
Thomas Trent WIESE, Appellant.
No. 83-322.
Supreme Court of Iowa.
January 18, 1984.
*859 W. Dennis Currell of Irvine, Currell, Gillespie & Broz, Cedar Rapids, for appellant.
Thomas J. Miller, Atty. Gen., Steven M. Foritano, Asst. Atty. Gen., and Mona Knoll, Asst. Linn County Atty., for appellee.
Considered by McGIVERIN, P.J., and LARSON, SCHULTZ, CARTER and WOLLE, JJ.
SCHULTZ, Justice.
Defendant, Timothy Trent Wiese, appeals from conviction and sentence for a second offense of operating a motor vehicle while intoxicated (OWI) in violation of Iowa Code section 321.281 (1981). On appeal, he claims that the sentencing court's refusal to credit time voluntarily spent in an alcohol treatment facility against his sentence (1) was an abuse of discretion and resulted in an illegal sentence; and (2) violated his right to equal protection and due process of law under both the state and federal constitutions. Because we find no merit in defendant's contentions, we affirm his sentence.
Defendant was arrested on September 9, 1982, for a second offense OWI. Eventually, he pled guilty and sentencing was set for February 23, 1983. At sentencing, defendant raised the issue of credit for the one month he had voluntarily spent in an alcohol treatment center after his arrest but before he subsequently pled guilty. The court took the matter under advisement but ultimately denied credit at the rescheduled sentencing on March 17, 1983. Instead, the court (among other things) sentenced defendant to a thirty day jail term with twenty-three of those days suspended. It also credited him for the one day he initially spent in jail after arrest. Dissatisfied with the court's failure to grant his request for credit, defendant appealed, and his submission to custody was deferred pending resolution of this appeal. We first consider his constitutional challenges and then briefly address his contentions that the court abused its discretion and imposed an illegal sentence.
Defendant claims the trial court's refusal to allow him credit for time spent in the treatment facility denied him equal protection under both the state and federal constitutions. U.S. Const. amend. XIV; Iowa Const. art. I., § 6. He insists that section 321.281(4) applies to all offenders regardless of whether their commitment is voluntary or involuntary. This section provides:
As a condition of a suspended sentence or portion of sentence for a second, third or subsequent offense in violation of this section, the court upon hearing may commit the defendant for inpatient treatment of alcoholism or drug addiction or dependency to any hospital, institution or community correctional facility in Iowa providing such treatment. The time for *860 which the defendant is committed for treatment shall be credited against the defendant's sentence. The court may prescribe the length of time for the evaluation and treatment or it may request that the hospital to which the person is committed immediately report to the court when the person has received maximum benefit from the program of the hospital or institution or has recovered from the person's addiction, dependency, or tendency to chronically abuse alcohol or drugs. A person committed under this section who does not possess sufficient income or estate to make payment of the costs of the treatment in whole or in part shall be considered a state patient and the costs of treatment shall be paid as provided in section 125.44.
Id. (Iowa Code 1983) (emphasis added). Essentially, he claims the legislature in allowing credit for time spent in treatment never intended to make a distinction between involuntary and voluntary commitments. Thus, he contends the court's refusal to grant him credit because his commitment was voluntary resulted in a judicial classification that had no reasonable relationship to the legislature's intended objective.
We cannot agree with defendant that the legislature's mandate to credit the time a defendant is committed for treatment against his sentence applies to time voluntarily spent in such treatment. This directive must be read in conjunction with the rest of section 321.281(4). In particular, the statute allows the court to commit a defendant for treatment as part of sentence or as condition of a suspended sentence. If the treatment option is chosen, then but only then, does the statute direct the court to credit that time against his sentence. Since the sentencing judge correctly interpreted this section to apply only to offenders involuntarily committed by the court, defendant's equal protection challenge must stand or fall on the initial classification by the legislature.
We believe it must fall for two reasons. First, offenders who voluntarily commit themselves are not similarly situated to offenders who are committed against their will and as a condition of their punishment. Even assuming both classes of offenders were similarly situated for equal protection purposes, the challenge still must fail. To prevail on an equal protection claim not involving a suspect classification or fundamental right defendant must negate every reasonable basis for the legislative classification. Stracke v. City of Council Bluffs, 341 N.W.2d 731, 733 (Iowa 1983).
While one of the legislative goals underlying this section may be enhancement of the public safety by removing drunk drivers from the street and attempting to rehabilitate them, another objective is to allow the courts more discretion in dealing with this type of offender. Since the treatment alternative judicially confines a defendant, the legislature could reasonably conclude credit should be allowed for those involuntarily confined but not for those who voluntarily undergo such treatment. Indeed, the purpose of enhancing a sentencing court's punishment choices could be frustrated if credit were extended to volunteers since an offender could choose his own place and length of confinement. Although the legislative distinction does result in some inequality, this fact alone does not render the statute unconstitutional. See, e.g., Mills v. State, 308 N.W.2d 65, 67 (Iowa 1981) (no violation of equal protection where, in cases of revocation, parolees are given credit for time spent on parole while probationers are not given credit for time spent on probation).
Defendant's due process challenge based on the Fourteenth Amendment of the federal constitution and Article I, section 9 of the state constitution must also fail. Because there is no constitutional entitlement to credit, defendant cannot base a due process claim on the court's failure to allow credit. State v. Holmes, 276 N.W.2d 823, 830 (Iowa 1979).
Finally, the sentencing court did not abuse its discretion or impose an illegal sentence. Since the defendant did not have *861 any statutory or other entitlement, the court was not required to give him credit. The sentence pronounced was well within the limits provided by law. Iowa Code §§ 321.281 and 903.1(1) (1981). Moreover, the court properly considered the factors enunciated in State v. Dvorsky, 322 N.W.2d 62, 67 (Iowa 1982) in arriving at defendant's sentence.
Having determined that defendant's contentions lack merit, the sentence is affirmed.
AFFIRMED.
