Not too many years ago, when you wrote a check to a business, it would often take several days before the check could be mailed or hand-delivered to your bank for payment. That "float" time was something that many people exploited, knowing that they had a few days to get the deposit to the bank. Then the law changed allowing for the electronic presentation of checks. Now, as soon as a check is written, the recipient has the option of presenting it electronically for payment.
What that means for you is even if your bank is across the street from the grocery store, writing a check before you make the deposit is a very bad idea. Ask your bank about its procedures for processing an electronic check. Some banks will place a hold for the amount of the check on your account and then wait for a day or two to clear the transactions. Others treat electronic checks the same as a debit card and the procedure for the processing them is to remove the payment from your account immediately.
Most often, the retailer or other check recipient sends an electronic message to the bank telling them you have written a check and the amount it is for. Then, the electronic check is processed at the end of the day, along with the days other credits and debits.