Do you have a lease with the owner?
If so, there is a federal law, the Protecting Tenants in Foreclosure Act, which provides tenants with protections: 1) First, it provides that the successor in interest must provide at least a 90-day notice to the tenant to vacate the property (and this is only after they actually acquire title to the property); and 2) If the tenant has a lease or tenancy that is greater than 90-days, it must be honored unless the successor in interest will use the property as a primary residence. Since the bank would likely be the successor in interest, the bank would have to honor the lease terms and let you remain in the property for the duration of the lease. This protection applies to any lease entered into “before the notice of foreclosure,” which under this law has been defined to be the date on which “complete title” is transferred to the successor person or entity as a result of the foreclosure process. This means that the relevant date is at the end of the foreclosure process (e.g., the recording of a foreclosure deed to the successor in interest) rather than the beginning of the foreclosure process.
Worst case, sale is often scheduled soon after the redemption (normal redemption is 90 days, but the court does have discretion to alter the redemption period), but I have cases where for whatever reason the bank does not try to sell the property for weeks or even months. Additionally, to confirm the sale they will have to get onto the court calendar. Right now the clerk is giving out late April-May dates, meaning you can expect 2-3 months, not weeks. Further, the owner will likely be granted at least an additional 30 days of possession in the order for possession. Then, you would legally have to be evicted before you were ordered to leave the property since you were not a party to the foreclosure. So, you have a considerable amount of time. These are obviously not guarantees, but simply rough timeframes based upon my experience.
Again, if you have a lease, the bank must honor it, and you can stay the duration of your lease, subject to the exceptions listed above (purchaser intends to reside in property for primary residence). Otherwise, you have 90 days notice from the date they serve YOU with the notice, not 90 days from the date the owner receives notice of the confirmed sale.
Another thing to be aware of: more and more banks are entering into leases with current tenants. Simply too many properties to sell, and they are starting to want to keep tenants in the property for longer.