A habit is a behavior demonstrated regularly. Humans find unhealthy habits hard to break and new positive habits difficult to form.
Conventional wisdom suggests it takes 21 days to form a new habit. While the exact number of days needed will be challenged by some, it is certainly true that it takes repetition to form a new habit, the very definition of a habit. How long it takes a new behavior to become consistent and almost instinctual will vary from person to person. Regardless, 21 days is not a bad target to start with.
Decide what you want to change. Track occurrences (or non-occurrence as the case may be). Identify what positively motivates you each day to continue the behavior and what negative things occur that undermine your motivation and serve to suppress or extinguish your desired behavior. Surround yourself with more of the former and avoid the latter. Get to 21 days, and then press on.