I think that is going to depend on the habit to some extent. However, the ultimate requirement for quitting a habit is determination.
My father died when he was 63 from clogged arteries. He had several surgeries to clean, bypass, etc. One day, the doctor saw him smoking in the waiting room and told him he had to stop.
He spent about a week trying to cut down a little and one day, He did not have his first cigarette of the day. He told my mother to throw them away and pick up all the ash trays. He had probably been smoking for 40 or more years. He quit that day and never picked up another cigarette--he wanted to, but he did not. He died two years later. I wished he had quit sooner. He might have lived longer.
Bottom line is if you have a habit you have to want to break it, you have to stick to it and have to realize there are times you are going to be uncomfortable.