
194 Cal.App.3d 1 (1987)
239 Cal. Rptr. 458
THE PEOPLE, Plaintiff and Appellant,
v.
JOHN TAFOYA, Defendant and Respondent.
Docket No. 24562.
Court of Appeals of California, Appellate Department, Superior Court, Los Angeles.
July 7, 1987.
*2 COUNSEL
Ira Reiner, District Attorney, Eugene D. Tavris and Brentford Ferreira, Deputy District Attorneys, for Plaintiff and Appellant.
Samuel Sussman for Defendant and Respondent.
*3 OPINION
NEWMAN, J.
This appeal is taken by the People from an order which credited defendant pursuant to Penal Code section 2900.5 with time voluntarily spent in a drug rehabilitation program.[1] Upon reviewing the procedural facts of the case (which are undisputed) and the applicable law, we conclude that the order must be reversed.

STATEMENT OF THE CASE
On February 11, 1985, a misdemeanor complaint was filed against defendant charging him in count I with violation of Health and Safety Code section 11550, subdivision (a) (being under the influence of a controlled substance, an opiate), and in count II with violation of Vehicle Code section 23152, subdivision (a) (driving under the influence of alcohol, a drug or the combined influence of both). Defendant pleaded not guilty to the charges but later withdrew his plea on count II and pleaded nolo contendere. He received a standard sentence for a first-time driving-under-the-influence conviction. On count I, the case was sent out for preparation of a probation report under Penal Code section 1000.2. The probation report found defendant eligible but not suitable for diversion. Diversion was denied in June 1985, but granted one month later by a different judge. Thereafter, defendant completed a six-week drug diversion program.
Subsequent to completion of the diversion program, defendant was again arrested for driving under the influence. He then voluntarily entered Warm Springs Rehabilitation Center, spending 90 days at Warm Springs in a live-in substance-abuse program. Diversion was terminated and criminal proceedings were reinstated on count I of the February 11, 1985, complaint. Defendant pleaded guilty to count I after the court indicated that it would credit him, under Penal Code section 2900.5, with the 90 days he spent at Warm Springs. The court then sentenced defendant to one year summary probation and 180 days in county jail. With respect to the 180 days, the court suspended 90 days of that time and credited defendant for the remaining 90 days, as it had indicated it would do. The credit was given to *4 defendant over the People's objection. The People argued that no credit should be given as defendant's enrollment in the Warm Springs program was wholly voluntary.

DISCUSSION
(1) The provisions of Penal Code section 2900.5 which grant a defendant credit for time served specifically require that the defendant have been in custody. In construing the words "in custody," the court in People v. Rodgers (1978) 79 Cal. App.3d 26 [144 Cal. Rptr. 602] took note of an explanation which the author of section 2900.5 (both in its original form and its 1976 amendment) gave for the 1976 amendment. Its author, State Senator Alan Sieroty, referred to "`restriction[s] on a person's liberty ... imposed by a court. ...'" (Id., at p. 32, second italics added.)
In People v. Mobley (1983) 139 Cal. App.3d 320 [188 Cal. Rptr. 583], the defendant was released on his own recognizance pending trial on the condition that he reside in a certain facility until then. When defendant was ultimately sentenced, he was given credit for time spent at that facility. On appeal, the People conceded that defendant was entitled to such credit and the court said "The right to credit is based not on the procedure by which a defendant is placed in such a facility, but on the requirements that the placement be `custodial' ...." (Id., at p. 323, italics added.)
In In re Watson (1977) 19 Cal.3d 646 [139 Cal. Rptr. 609, 566 P.2d 243] the court said with reference to section 2900.5, "The crucial element of the statute is not where or under what conditions the defendant has been deprived of his liberty but rather whether the custody to which he has been subjected `is attributable to charges arising from the same criminal act or acts for which the defendant has been convicted.' [Citation.]" (Id., at p. 651, italics added.)
Rodgers, Mobley and Watson demonstrate that the term "in custody" as used in section 2900.5 cannot be construed to include a defendant's self-imposed stay at a drug rehabilitation facility. This analysis is in keeping with the intent of the Legislature in enacting section 2900.5, which was to eliminate the inequality between those financially able to post bail and those too poor to do so. (In re Hodges (1979) 89 Cal. App.3d 221, 225-226 [152 Cal. Rptr. 394].) In enacting the statute and its amendment, the Legislature addressed situations where defendants were confined to a facility (be it penal or rehabilitative) by court order.
(2) In the instant case, defendant's stay at Warm Springs was not court imposed. He was not placed there or subjected to the treatment; he placed *5 and subjected himself. Contrary to defendant's assertion, People v. Sylvestry (1980) 112 Cal. App.3d Supp. 1 [169 Cal. Rptr. 575] does not stand for the proposition that a defendant who places himself in a rehabilitation facility will be given time credit under section 2900.5. Defendant was not "subject[ed] to restraints not shared by the `public generally.'" (People v. Rodgers, supra, 79 Cal. App.3d at p. 31, italics omitted.) He volunteered for whatever restraints were imposed on him at Warm Springs.
There is yet another reason why defendant's voluntary commitment to Warm Springs cannot be used by him under section 2900.5. Subdivision (b) of that section states in pertinent part: "For purposes of this section, credit shall be given only where the custody to be credited is attributable to proceedings related to the same conduct for which the defendant has been convicted." (In re Watson, supra, 19 Cal.3d at p. 651; People v. Sylvestry, supra, 112 Cal. App.3d Supp. at pp. 6-7; People v. Mobley, supra, 139 Cal. App.3d at p. 323.) Thus, for defendant to be given credit for his time at Warm Springs, he would have to show that it is attributable to the February 11, 1985, charge of being under the influence of an opiate, the charge to which this credit was applied. It is more probable, however, that defendant sought treatment in hopes of receiving consideration of same with respect to the later driving-under-the-influence charge. We cannot say that, but for the diversion violation, defendant would not have entered the program at Warm Springs.
Finally, defendant's public policy argument that courts should reward those who recognize their substance abuse problem and voluntarily seek help, by applying section 2900.5 to them, is misdirected. It is the Legislature which must act to change the requirements of that section.
The order pursuant to Penal Code section 2900.5 crediting defendant with time voluntarily spent in a drug rehabilitation program is reversed, and the cause is remanded for resentencing.
Cooperman, P.J., concurred.
NOTES
[1]  Penal Code section 2900.5 states in pertinent part: "(a) In all felony and misdemeanor convictions, either by plea or by verdict, when the defendant has been in custody, including but not limited to any time spent in a jail, camp, work furlough facility, halfway house, rehabilitation facility, hospital, prison, juvenile detention facility, or similar residential institution, all days of custody of the defendant, ... shall be credited upon his term of imprisonment, or credited to any fine which may be imposed, at the rate of not less than thirty dollars ($30) per day, or more, in the discretion of the court imposing the sentence....

"(b) For the purposes of this section, credit shall be given only where the custody to be credited is attributable to proceedings related to the same conduct for which the defendant has been convicted...."
