There is no perfect answer to this question! It depends on the habit, the person, the season, and so many other factors.
In one study, it took anywhere from 18 days to 254 days for people to form a new habit.
So if you are still working on developing a new habit, keep trying! Don’t give up!