If you are already connected to the grid, then you can simply just feed the electricity back into the grid when over-producing (which is tracked by your meter), and then use electricity from the grid at night.
This actually works in your benefit if you have solar panels, because electricity prices are higher during the middle of the day (more demand). So you can "sell" daytime electricity (at high prices) [1], and then buy electricity at night which is much cheaper. This actually is the main benefit of the battery if you are connected to the grid, you can do the same thing.
1: You don't want to sell past your own consumption though otherwise you get paid very little for it
Except that, as pointed out above, the utilities only pay the wholesale rate for the electricity they buy back from you, and sell the overage to your neighbors for full price. Meanwhile, you're likely losing money selling your peak day electricity for 5 cents and buying it back for 15.
At least with PG&E, my understanding was that those rates only applied to a net over-production over a long period of time (I believe over the course of a year). As long as your power bill is not negative, any over-production during high value times of the day is sold at the market rate and offsets low value electricity you buy at night.
This is important with solar system sizing, because not only don't you want to be a net exporter of energy, the lower tiers of PG&E's energy rates are very cheap so you don't want to generate that power either. You really only want to offset the high-tier, high-demand electricity you use (or plan to use in the future).
For me it didn't really matter because my energy usage is highest during the peak times of the day, but this is my understanding of how it works. I'll know for sure in a couple of months when I see my bill :)
This is correct. Under Net-Metering policies in effect in California for systems installed now, you get reimbursed at full retail rates for every kWh you produce and export to the grid up to the level you import from the grid when solar is insufficient to need (at night, etc.) The wholesale rate is only for exported power generated beyond imported use.
This actually works in your benefit if you have solar panels, because electricity prices are higher during the middle of the day (more demand). So you can "sell" daytime electricity (at high prices) [1], and then buy electricity at night which is much cheaper. This actually is the main benefit of the battery if you are connected to the grid, you can do the same thing.
1: You don't want to sell past your own consumption though otherwise you get paid very little for it