I've heard multiple theories on how long it takes to break a habit. Seven days...30 days...etc. However, I think the real answer on how long it takes to break a habit is that there is no set time. It is going to depend on many factors, including how long the habit has been a habit, how motivated the person is to change, the environment in which the person is in. I think people get confused with the word habit. A habit can refer to something simple, such as not putting away laundry, but it can also refer to something more complex that could take a lot more effort in breaking. It takes a lot less time to form a habit, than to break a habit, and it is much harder to break said habit. The longer a person has been engaging in whatever the habit is, the longer it will take to break it. Overnight change really isn't possible.
One can decide to change something in a second, but that's not changing it. Changing a way of thinking, breaking a habit, stopping a negative behavior...it all takes work; it takes commitment. It takes the person being ready to change. If someone's not willing to change, you can't make them do it.
It's like exercising, or playing a musical instrument. You can't exercise once and expect to be in shape. Just like you cannot pick up an instrument and expect to go to Carnegie Hall the next week. It takes work, commitment, and among other things, the right mindset. Sticking with something is hard. It can be frustrating when it seems not to go your way. The key is to keep going with it. Setbacks will happen; it's a part of the process. What's important is to not get caught up in those setbacks, and not give up because of them. You can't have unrealistic expectations about how long or short you have to spend not engaging in the habit. It is going to depend on the habit, as well. Some are easier to stop doing, whereas others may be a lifelong fight. I think frustration is one of the harder aspects to deal with. While you may want to engage in the particular behavior, you also know it wouldn't be good for you. It's a constant back and forth. Sometimes you want to engage in the behavior just to make the frustration go away. This is where it becomes important to bring new activities into your life.
Someone once told me that the brain learns by addition, not subtraction. So if you want to change a behavior, break a habit, you can't just eliminate whatever it is from your life. You have to find something to do in place of it. Addition, not subtraction.