It depends on the type of cake. Pound cakes, and fatty, rich cakes like carrot cake are going to have the longest shelf life. Some of them even improve in flavor over a day or two, and should last at least 3 and maybe up to 4 or 5 days. Even some of the shorter lifespan cakes, like genoise, should be good for at least 24 hours. Much depends on what you are layering or assembling the cake with, as well as what the layers are made of.
For example, if you have a pastry cream or whipped cream layer, these really only last a few hours.
Cakes also freeze exceedingly well, especially prior to being iced.
What you may choose to do is bake your layers or base cake at your convenience, let them cool, then wrap them well, and freeze.
Then, as reasonably close to service as is convenient, thaw the layers and ice, and optionally decorate as appropriate.
You can also freeze iced cakes, although it is a little trickier.