Obviouslly your goal as a web developer is to make money. That also means you need to get paid for the work you've been comissioned for. Setting the right expectations for your client early on can save you a lot of time, money and less stress in the long term. Depending on the size and type of project you will want to make sure you spend the appropriate amount of time  setting the right expectation.

The best time, and the easiest time to set expectations is before the project starts. That's before your client has made the final agreement to start a project with you. The more experienced web developers will not take on every project they have the opportunity.

The next most important time to set expectations is during the project. Mostly it's to keep your project in scope and to keep from doing something unexpected that your client didn't pay for.