Many people believe in the 21-day habit formula. Does it really only take 21 days to form a new habit? As a recent study has described[1]https://onlinelibrary.wiley.com/doi/abs/10.1002/ejsp.674 , this is just a myth. According to University College London[2]http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.695.830&rep=rep1&type=pdf, t. the time it took participants to reach 95% of their asymptote of automaticity ranged from 18 to 254 days (the median time was 66 days); indicating considerable variation in how long it takes people to reach their limit of automaticity and highlighting that it can take a very long time. Missing one opportunity to perform the behaviour did not materially affect the habit formation process.
So to develop a habit, you need 18 to 254 days, but most likely 66 days.