If you spank your kids, it must always be at a time well after the behavior that called for the spanking.
Punishment must be applied swiftly enough to be associated with the bad behavior.
A couple hours later gives them time to stew on whats coming. And keeps you from lashing out in anger instead of as discipline.