Minimum 3 days maximum 5 to 7 days. If you are planning travel only within Nainital 4 to 5 days are fine. If you are planning almora, Kausani, Kilbury, sariyatal, khurpatal, you need 7 days time to explore.
2 days enough for Nainital. lake, temple and mall road can cover in half day. all nearby walkable places. eco cave can plan if kids along or it interests you. High altitude zoo will take half day. Do visit the zoo. we'll maintained with good birds and animals. peak or snow point can plan depending on climate like can avoid if cloudy. If want to cover nearby places around then plan more days. Bhimtal, Sattal, Naukuchiatal, Hanuman Garhi, Mukteshwar etc