If you have plants, you need a regular lighting period ... 12hr out of 24 is a good place to start.
For fish only, you can have the lights on only when you are there to look at the fish, as long as there is some ambient light in the room so the fish is not totally in the dark the rest of the time. However, fish are reputed to develop better color with good regular light. <This is for FW
... if you are doing reef, then you must have good light & very specific lighting periods.>