You must practice it consistently for a few months.
To reiterate: In order to build (or break) a habit, you must practice doing (or not doing) it (the habbit) consistently for a few months.
It is worth mentioning that “consistently” means making no exceptions. You must do (or not do) the habit - always. The only exception you get is medical emergencies (or emergencies of similar severity).