On average an electrician can install a light switch in under an hour. If upgrading to a different type of switch it may take longer.
Although some choose to install light switches themselves, many instead hire an electrician. If you do not have previous electrical experience it is highly recommended that you do not perform any electrical work, even a simple light switch installation. An electrician will not only get the job done safely, they can identify potential problems and address them first.