A new habit can take 18 days, or 254
In one well-known study, new daily habits took 18 to 254 days to come close to their peak automaticity, so there is no fixed deadline.
New daily habits can take anywhere from a few weeks to most of a year to come close to automatic. The idea that a habit takes a set number of days does not hold up.
The study
Volunteers each chose one eating, drinking, or activity behavior to do daily in the same setting, such as after breakfast, for 12 weeks. Every day they recorded whether they did it and how automatic it felt. The time people took to get close to their own peak of automaticity ranged from 18 to 254 days. Doing the behavior more consistently went with a clearer pattern of the habit forming.
Starting small
If a new habit still takes effort after a few weeks, that is normal. Tying it to the same moment each day, like after your morning coffee, keeps the repetition steady while it settles in at its own pace.