Generally, for a better deal it’s recommended to book in a timely manner (to save up to 29%). Cheapflights recommends you book around 90 days prior to your deserved date. Booking as early as you can also increases the likelihood that you’ll get the ideal car.
Typically how long you can rent a car for depends on the inventory of the supplier. For Tirupati Airport however, it is certainly possible to rent a car for an entire month.