Any person who has been committed to the county jail or to any city jail in Jackson County under a criminal sentence may be released therefrom at the discretion of the sentencing court, either on its own motion or upon the motion of the defendant, at the time of sentence or at any time during the term of sentence, for the purpose of obtaining and working at gainful employment or for such other purposes as the court may deem conducive to his or her rehabilitation, for such time or intervals of time and under such terms and conditions as the court may order. Any part of a day spent outside of jail under such a release order shall be counted as a full day toward the serving of the sentence unless otherwise provided by the court. If a person violates the terms and conditions laid down for his or her conduct, custody, and employment, he or she shall be returned to the sentencing court. The court may then require that the balance of the person’s sentence be spent in actual confinement and may cancel any earned reduction of his or her term.