Any person incarcerated on a charge of violating a bailable municipal ordinance who does not supply bail and against whom a fine is levied upon conviction of such offense, shall be allowed a credit of $2.00 for each day so incarcerated prior to conviction, but such credit shall not exceed the amount of the fine levied.
65 ILCS 5/1-2-12