The time to form a new habit depends on the person, the habit itself, the environment, and the motivation. Generally speaking, 60 days is good enough for getting a new habit formed, but some habits could take twice as long. Some habits will never be formed no matter how much time passes. Even a habit that takes months or years to form can still be broken eventually.
Becoming an early riser was really challenging. I struggled with this habit for years to manage to form it. I do break this habit now and then, usually by choice to experience something different for a while. In the past 90 days, I have stayed in bed past 5 am perhaps only two or three times. It takes me less than a week to be back with it. Remembering the benefits surely helps.
In my 20s I was too impatient with many habits. If I couldn't get something working in a few weeks, I'd often drop it and try something else. Now that I'm in my late 40s, I have learned to think in a more practical way. I know that even if it takes many months or years to form a new habit, I am sure the habit could bring advantages for many years. It doesn't take me too long to think of carrying out the new habit, I just get it started. When you think about a habit that you have stuck to for many years, who cares if it took a few weeks or six months to form it?
Don't worry so much about how long it takes to form a habit. Instead, consider which habits could improve the quality of your life so that they are worthy of six months to get them formed. When a habit forms at last, it feels uncomfortable not to do it, and your day doesn't feel complete without it.