I recall a statistic from a study a decade ago that it takes an average of 28 repetitions to create a new habit. Of course, that all depends how deep the old habit goes, how vivid the new habit strikes us and how easy it is to perform the new task.
If you have tried to diet or tried to quit smoking or tried to stay on an exercise program. Don't give up. You can teach a new dog old tricks. Or is it the other way around?