When a person has been committed to the custody of the authority, if it is deemed warranted by a diagnostic study and recommendation approved by the director, the judge who ordered the commitment or, if the judge is not available, the presiding judge of the court, within 120 days of the date of commitment on his or her own motion, or the court, at any time thereafter upon recommendation of the director, may recall the commitment previously ordered and resentence the person as if he or she had not previously been sentenced. The time served while in custody of the authority shall be credited toward the term of any person resentenced pursuant to this section.
As used in this section, "time served while in custody of the authority" means the period of time during which the person was physically confined in a state institution by order of the Department of the Youth Authority or the Youth Authority Board.
Ca. Welf. and Inst. Code § 1737