(a) Every person shall be given credit on the maximum and the minimum term of imprisonment for time spent in custody, or on parole in accordance with § 24-406, as a result of the offense for which the sentence was imposed. When entering the final order in any case, the court shall provide that the person be given credit for the time spent in custody, or on parole in accordance with § 24-406, as a result of the offense for which sentence was imposed.
(b) When a person has been in custody due to a charge that resulted in a dismissal or acquittal, the time that would have been credited against a sentence for the charge, had the charge not resulted in a dismissal or acquittal, shall be credited against any sentence that is based upon a charge for which a warrant or commitment detainer was placed during the pendency of the custody.
(c) Any person who is sentenced to a term of confinement in a correctional facility or hospital shall have deducted from the term all time actually spent, pursuant to a court order, by the person in a hospital for examination purposes or treatment prior to trial or pending an appeal.
1981 Ed., § 24-431.