California Penal Code 1170.18.

(a) A person currently serving a sentence for a conviction, whether by trial or plea, of a felony or felonies who would have been guilty of a misdemeanor under the act that added this section (“this act”) had this act been in effect at the time of the offense may petition for a recall of sentence before the trial court that entered the judgment of conviction in his or her case to request resentencing in accordance with Sections 11350, 11357, or 11377 of the Health and Safety Code, or Section 459.5, 473, 476a, 490.2, 496, or 666 of the Penal Code, as those sections have been amended or added by this act.
(b) Upon receiving a petition under subdivision (a), the court shall determine whether the petitioner satisfies the criteria in subdivision (a). If the petitioner satisfies the criteria in subdivision (a), the petitioner’s felony sentence shall be recalled and the petitioner resentenced to a misdemeanor pursuant to Sections 11350, 11357, or 11377 of the Health and Safety Code, or Section 459.5, 473, 476a, 490.2, 496, or 666 of the Penal Code, those sections have been amended or added by this act, unless the court, in its discretion, determines that resentencing the petitioner would pose an unreasonable risk of danger to public safety. In exercising its discretion, the court may consider all of the following:
(1) The petitioner’s criminal conviction history, including the type of crimes committed, the extent of injury to victims, the length of prior prison commitments, and the remoteness of the crimes.
(2) The petitioner’s disciplinary record and record of rehabilitation while incarcerated.
(3) Any other evidence the court, within its discretion, determines to be relevant in deciding whether a new sentence would result in an unreasonable risk of danger to public safety.
(c) As used throughout this Code, “unreasonable risk of danger to public safety” means an unreasonable risk that the petitioner will commit a new violent felony within the meaning of clause (iv) of subparagraph (C) of paragraph (2) of subdivision (e) of Section 667.
(d) A person who is resentenced pursuant to subdivision (b) shall be given credit for time served and shall be subject to parole for one year following completion of his or her sentence, unless the court, in its discretion, as part of its resentencing order, releases the person from parole. Such person is subject to Section 3000.08 parole supervision by the Department of Corrections and Rehabilitation and the jurisdiction of the court in the county in which the parolee is released or resides, or in which an alleged violation of supervision has occurred, for the purpose of hearing petitions to revoke parole and impose a term of custody.
(e) Under no circumstances may resentencing under this section result in the imposition of a term longer than the original sentence.
(f) A person who has completed his or her sentence for a conviction, whether by trial or plea, of a felony or felonies who would have been guilty of a misdemeanor under this act had this act been in effect at the time of the offense, may file an application before the trial court that entered the judgment of conviction in his or her case to have the felony conviction or convictions designated as misdemeanors.
(g) If the application satisfies the criteria in subdivision (f ), the court shall designate the felony offense or offenses as a misdemeanor.
(h) Unless requested by the applicant, no hearing is necessary to grant or deny an application filed under subsection (f ).
(i) The provisions of this section shall not apply to persons who have one or more prior convictions for an offense specified in clause (iv) of subparagraph (C) of paragraph (2) of subdivision (e) of Section 667 or for an offense requiring registration pursuant to subdivision (c) of Section 290.
(j) Any petition or application under this section shall be filed within three years after the effective date of the act that added this section or at a later date upon a showing of good cause.
(k) Any felony conviction that is recalled and resentenced under subdivision (b) or designated as a misdemeanor under subdivision (g) shall be considered a misdemeanor for all purposes, except that such resentencing shall not permit that person to own, possess, or have in his or her custody or control any firearm or prevent his or her conviction under Chapter 2 (commencing with Section 29800) of Division 9 of Title 4 of Part 6.
(l) If the court that originally sentenced the petitioner is not available, the presiding judge shall designate another judge to rule on the petition or application.
(m) Nothing in this section is intended to diminish or abrogate any rights or remedies otherwise available to the petitioner or applicant.
(n) Nothing in this and related sections is intended to diminish or abrogate the finality of judgments in any case not falling within the purview of this act.
(o) A resentencing hearing ordered under this act shall constitute a “post conviction release proceeding” under paragraph (7) of subdivision (b) of Section 28 of Article I of the California Constitution (Marsy’s Law).
(Added November 4, 2014, by initiative Proposition 47, Sec. 14.)