This can vary depending on the itinerary. Caribbean, Hawaiian, Alaskan cruises are more informal while Transatlantic, Mediterranean and European cruises tend to be a little more formal. This can also vary from cruise line to cruise line and ship to ship. Princess Cruise Line would probably lean toward formal whereas Carnival will tend to be more informal and casual. There is no real hard and fast rule, however, here's a try.
Ladies can take cocktail dresses or a full length formal.
The rest of the time is typically very casual. One of the most attractive features of a cruise vacation is the price. Even more expensive cruises are a good value for the money. Undoubtedly, a cruise is the most affordable way to travel. Your ship will typically arrive in port early in the morning at which time you are free to go ashore.