if its the alternator, it could be that the charge rate is too low or that there is simply no charge etc, car will still start, but the battery will not be charging properly so will eventually just die.
If its the battery that is maybe getting old and not taking charge properly, then its just a case of replacing the battery.