Does Being on Pretrial House Arrest Count Towards Jail Time Credit?

leaning on jail cell bars

This is a question that I am commonly asked.  Consider the following hypothetical scenarios:

Brett is arrested for a criminal offense and booked into the county jail.  Within the time period set by statute, the court holds a hearing and sets bail (an amount of money which Brett must pay to be released from jail and secure his appearance at any future hearings in the case).