46-18-403. Credit for incarceration prior to conviction. (1) (a) A person incarcerated on a bailable offense against whom a judgment of imprisonment is rendered must be allowed credit for each day of incarceration prior to or after conviction, except that the time allowed as a credit may not exceed the term of the prison sentence rendered.
(b) For the purposes of subsection (1)(a), incarceration includes time spent in a residential treatment facility under the order of a court.
(2) A person incarcerated on a bailable offense who does not supply bail and against whom a fine is levied on conviction of the offense may be allowed a credit for each day of incarceration prior to conviction, except that the amount allowed or credited may not exceed the amount of the fine. The daily rate of credit for incarceration must be established annually by the board of county commissioners by resolution. The daily rate must be equal to the actual cost incurred by the detention facility for which the rate is established.